javascript - Can anyone tell me why I am getting Uncaught SyntaxError: Unexpected string? -
this code below.
the error above not move, trying lots of different variants.
var $token = $(this).attr('id'); var $itemid = $(this).find('input.id').val(); var $instaurl = 'https://api.instagram.com/v1/media/"'.$itemid.'"/likes?access_token="'.$token.'"'; console.log($instaurl);
thanks
javascript uses +
string concatenation:
var $token = $(this).attr('id'); var $itemid = $(this).find('input.id').val(); var $instaurl = 'https://api.instagram.com/v1/media/"'+$itemid+'"/likes?access_token="'+$token+'"'; console.log($instaurl);
you used dot (.
) php.
by way, not need use dollar sign variables in javascript!
Comments
Post a Comment