我试图了解用户是否喜欢某个页面。
这是javascript即时使用:
window.fbAsyncInit = function() {
FB.init({
appId : '660879460653316',
cookie : true,
xfbml : true,
version : 'v2.0'
});
FB.getLoginStatus(function(response) {
var page_id = '476851132449446';
if (response && response.authResponse) {
var user_id = response.authResponse.userID;
FB.api({
method: 'fql.query', query: 'SELECT uid FROM page_fan WHERE uid= ' + user_id + ' AND page_id=476851132449446'
}, function(result) {
console.log(result);
if (result.length) {
console.log('liked');
}
else {
console.log('dislike');
}
});
}
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
我将一个空对象作为回应。
问题是什么?
谢谢你!