这让我困惑了几天。我尝试使用Facebook的Javascript SDK编写批量请求,但它总是返回[null]。我错过了什么吗?提前谢谢。
FB.api('/', 'POST', {
batch: [
{method: 'GET', relative_url: 'me', omit_response_on_success: 'false'},
{method: 'GET', name: 'get-friends', relative_url: 'me/friends', omit_response_on_success: 'false'}
]
}, function(response) {
console.log(response);
});
答案 0 :(得分:0)
删除omit_response_on_success: 'false'
周围的单引号对我有用:
FB.api('/', 'POST', {
batch: [
{method: 'GET', relative_url: 'me', omit_response_on_success: false},
{method: 'GET', name: 'get-friends', relative_url: 'me/friends', omit_response_on_success: false}
]
}, function(response) {
console.log(response);
});