我需要随机获取 50 个 Facebook 朋友并将结果分配给user_ids
此函数中使用的变量sendRequestToRecipients()
。我想要做的就像在这个例子中:
Stack Overflow 上的所有示例都不起作用,我需要一些帮助才能使此功能正常工作。
这是我的代码:
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<input type="button"
onclick="sendRequestToRecipients();return false;"
value="Send Request to Users Directly"/>
<input type="button"
onclick="sendRequestViaMultiFriendSelector(); return false;"
value="Send Request to Many Users with MFS"
/>
</p>
<script>
FB.init({
appId : '398994226827517',
status : true,
oauth : true,
Xfbml : true,
cookie : true,
frictionlessRequests : true
});
function sendRequestToRecipients() {
var user_ids = document.getElementsByName("user_ids")[0].value;
FB.ui({method: 'apprequests',
message: 'sample message',
to: 'user_ids'
}, requestCallback);
}
function sendRequestViaMultiFriendSelector() {
FB.ui({method: 'apprequests',
message: 'sample message'
}, requestCallback);
}
function requestCallback(response) {
// Handle callback here
}
</script>