1
我試圖從Facebook的Graph Api和FQL,但我無法讓我的代碼工作。Javascript代碼不適用於Facebook Graph Api和FQL
function getUserMovies2() {
FB.api('/me/movies?fields=name,genre,release_date,picture,likes', function(response) {
console.log('Got Movies: ', response);
if (!response.error) {
var markup = '';
var movies = response.data;
for (var i=0; i < movies.length && i < 1; i++) {
var movie = movies[i];
FB.api('fql', { q: 'SELECT name FROM page WHERE genre = ' + movie.genre + 'LIMIT 1' }, function (response)
{
//do something with the response
// show name of the movie...
markup = '<p> Suggested Movie:'+ response + '</p>';
});
}
document.getElementById('user-movies').innerHTML = markup;
}
});
}
它應該顯示與我喜歡的第一部電影的同類型的第一部電影名字(頁)。這只是一個測試,但它不起作用。