FB.ui发送在回调中的响应变量中返回的变量

时间:2011-06-29 17:38:32

标签: javascript facebook facebook-javascript-sdk

我正在使用Facebook SDK FB.ui.我可以使用FB.ui传递一个参数,以便它与响应对象一起返回吗?

我目前的尝试:

FB.ui({
    method: 'stream.publish',
    message: message,
    display: 'popup', // force popup mode
    data: "shared_item_id=96"
    },    
function(response) {
    alert('Post was published.' + response.share_item_id);
});

是否有将shared_item_id放入响应对象?

1 个答案:

答案 0 :(得分:5)

我认为您可以使用关闭

解决此问题
FB.ui({
    method: 'stream.publish',
    message: message,
    display: 'popup' // force popup mode
    },    
(function(shared_item_id) {
    return function(response) {
        /* callback body */
        //share_item_id = 96
        alert('Post was published.' + shared_item_id);
    }
})(96/*value you want to have in callback*/)


);