这是我的代码
echo '<script type="text/javascript">
FB.init({
appId : "myappid",
channelUrl : "//www.mysite/channel.html",
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
if (response.status === "connected") {
FB.api(
"me/bookvote:download",
"post",
{
book: "http://samples.ogp.me/199815506812566",
fb:explicitly_shared = "true"
}
function(response) {
if (!response || response.error) {
alert("Error occured" + response.error);
} else {
alert("Post ID: " + response.id);
}
}
)
// else {
//do nothing since user did not authorize
// alert("I am an alert box!");
// }
}
}
)
</script>';
当我添加时,我在控制台中遇到的错误是 Unexpected token function
function(response) {
if (!response || response.error) {
alert("Error occured" + response.error);
} else {
alert("Post ID: " + response.id);
}
}
)
facebook 在这里https://developers.facebook.com/docs/reference/javascript/FB.api/演示了这一点,这些帖子没有发布到开发人员的 faecbook 墙上,所以我需要处理响应以查看哪些错误消息facebook 正在打印是否有另一种方法来处理响应?