This question already has an answer here:
I have the following code:
FB.getLoginStatus(function (response) {
if (response.status === "connected") {
FB.api("me/bookvote:download", "post", {
}, //Missing a , here?
however, I am still getting:
Uncaught SyntaxError: Unexpected identifier
for book: "<?php echo "http://mysite.xom/auction_details.php?name=$item_details["name"]&auction_id=$item_details["auction_id"]";?>",
what could be wrong in my php variable to JavacScript?
</div>
Wrap { } around your array items inside your string, like {$item_details["name"]}
Magic quotes are no longer supported. Change
book: "<?php echo "http://mysite.xom/auction_details.php?name=$item_details["name"]&auction_id=$item_details["auction_id"]";?>",
to
book: "<?php echo "http://mysite.xom/auction_details.php?name=" . $item_details["name"] . "&auction_id=" . $item_details["auction_id"];?>",
You're not concatenating properly in your PHP code:
FB.getLoginStatus(function (response) {
if (response.status === "connected") {
FB.api("me/bookvote:download", "post", {
book: "<?php echo 'http://mysite.xom/auction_details.php?name='. $item_details['name'] . '&auction_id=' . $item_details['auction_id']; ?>",
fb:explicitly_shared = "true" //? Is syntactically valid but creates a global
},
For readability, I replaced double quotes in your PHP code with single quotes.