This is my code below.
The error I get above will not move, I am 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 +
for 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 the dot ( .
) from PHP.
By the way, you do not need to use a dollar sign for variables in JavaScript!
Use +
for concatenation in javascript.It can also be done using the following methods:
a. The addition operator ( +
)
b. The assignment operator ( +=
)
c. The built-in concat
method
ar $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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.