如何从我网站上的Facebook对话框中访问返回数据?

时间:2011-04-10 02:26:17

标签: facebook

我在我的应用中使用Facebook request dialog

FB.init({
    appId  : 'app_id',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
});

$('.facebook_request').live('click',function(){ 
    FB.ui({
        method: 'apprequests',
        message: 'message',
        to: 'user_id'
    });
    return false;
});

到目前为止这是有效的。该请求会在当前页面中弹出,并且会正确创建。但我不知道如何访问here提到的返回数据(新创建的请求的id)。我怎样才能访问它以便我可以保存ID?

1 个答案:

答案 0 :(得分:2)

request_id回调回调:

FB.ui({
    method: 'apprequests',
    message: 'message',
    to: 'user_id'
}, function(response)
{
    for (i = 0; i < response.request_ids.length; i++)
    {
        alert(response.request_ids[i]);
    }
});