FB.api('/me/likes/124745260879931', onMyLikesResponse); not working on IE 9
any reason why the below code would not work in IE9 yet work in every other browser i try?:
FB.init({appId: '######', status: true, cookie: true, xfbml: true});
FB.api('/me/likes/######', onMyLikesResponse);
function onMyLikesResponse(response)
{
console.log("length" + response.data.length);
co开发者_StackOverflownsole.log(response);
if(response.data.length==1){
$('#like').show();
}
}
FB.login(function(response) {
if (response.status == 'connected') {
var page_id = "40796308305";
FB.api('/me/likes/'+page_id, function(response) {
if (response.data[0]) {
$('#like').show();
}
});
} else {
// user is not logged in
}
});
I think length will not work on json response. Make sure developer tools are open in IE9, cause you are using console.log.
精彩评论