我想知道如何通过发送facebook对话框发送私信后如何获得回复。
示例:
FB.ui({
app_id:"XXXXXXXXXXXXXXXXXXXXXXXXX",
method: 'send',
name: "Test send message",
link: 'www.mywebsite.gi',
to: ID_USER_FB,
description:'This is a test '
});
// here i would a response
if (response == TRUE) {
// do this
} else {
// do that
}
答案 0 :(得分:1)
FB.ui方法有两个参数:数据对象和回调函数,如下所示:FB.ui
回调函数将是这样的:
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
需要注意的重要一点是FB.ui方法是异步的,这就是它需要回调方法的原因。