我需要在邀请对话请求和函数看起来排除朋友
duplicate:function(){
var responsive = '';
FB.api(
{
method: 'fql.query',
query:'SELECT uid,name FROM user WHERE uid IN \n\
(SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1 '
},
function(response) {
responsive = response;}
);
return responsive;
},
onInviteClick: function(responsive) {
FB.ui( {
method: 'apprequests',
title: 'Popsecret ป็อบคอร์นแสนอร่อย',
exclude_ids: responsive
message: 'ชวนคุณกดไลท์เพื่อลุ้นรับไอแพดเเละของรางวัลอีกมากมาย',
max_recipients: 15
} , function(response) {
if (response !== null) {
$.post(Site.inviteCallbackURL, response, function(res) {
});
}
});
我无法将数据从重复传递到onInviteClick
答案 0 :(得分:0)
将var responsive = '';
从函数移动到全局范围。然后您可以从所有其他功能访问它。请记住,API调用是异步的,因此您需要等待请求的完成(jQuery Deferreds可能会帮助您)