我有一个Facebook api请求来自FB应用程序的帖子。我以为我在使用我的代码时遵循了正确的语法,但当我尝试拉出" data.name"它的到来"未定义"。
FB.api('/' + userName + '?fields=name,posts{message,created_time,full_picture,link,type,message_tags,description,from}',
{ access_token : pageAccessToken }, function(response) {
if (response && !response.error) {
for (var i = 0; i < response.data.length; i++){
var data = response.data[i];
console.log(data);
if (data.type !== "offer") { // types include: link, status, photo, video, offer
outputFBPost(data);
}
}
} else { console.log(response.error); }
});