[英]Facebook apprequest dialog
I'm using this code: 我正在使用此代码:
function newInvite(){
var user_ids = document.getElementsByName("user_ids")[0].value;
FB.ui({method: 'apprequests',
message: 'My Great Request',
to: user_ids,
});
}
I need to store the request id's i get from this function 我需要存储从此函数获取的请求ID
function loadFriends()
{
//get array of friends
FB.api('/me/friends?fields=name,first_name,gender', function(response) {
console.log(response);
var divContainer=$('.facebook-friends');
var testdiv = document.getElementById("test");
for(var i=0; i<response.data.length; i++){
if(response.data[i].gender == 'male'){
testdiv.innerHTML += response.data[i].id + '<br />';
}
}
});
}
How am i supposed to do it? 我应该怎么做?
Yes simple, 是的,很简单,
FB.ui({method: 'apprequests',
message: 'My Great Request',
to: user_ids,
}, requestCallback);
source: Request Dialog 来源: 请求对话框
[EDIT] [编辑]
function newInvite(users){
FB.ui({method: 'apprequests',
message: 'My Great Request',
to: users.join(',')
});
}
function loadFriends()
{
//get array of friends
FB.api('/me/friends?fields=name,first_name,gender', function(response) {
console.log(response);
var divContainer=$('.facebook-friends');
var testdiv = document.getElementById("test");
var users = [];
for(var i=0; i<response.data.length; i++){
if(response.data[i].gender == 'male'){
testdiv.innerHTML += response.data[i].id + '<br />';
}
users.push(response.data[i].id);
}
console.log(users)
newInvite(users);
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.