下面是一些测试代码:
<script>
var movieList = new Array();
var friendList=" ";
var friendCount = 0;
function get_friend_likes() {
FB.api('/me/friends', function(response) {
friendCount = response.data.length;
for( i=0; i<response.data.length; i++) {
friendId = response.data[i].id;
friendList=friendList+(response.data[i].name)+'<br/>';//store names
FB.api('/'+friendId+'/movies', function(result) {
movieList = movieList.concat(result.data); //fetch data to the pool
friendCount--;
document.getElementById('test').innerHTML = friendCount
+ " friends to go ... ";
});//end_FB.api
} //end_for
});//end_FB.api
}
</script>
问题是:我可以通过外部 FB.api 调用成功获取朋友的姓名和 ID,但在内部 FB.api 调用中无法获取“/movies”信息。返回的数据为空。对此有何见解?非常感谢!!