FB.ui send variable returned in response variable in callback
I am using the Facebook SDK FB.ui. Can I pass a parameter with FB.ui so that it is returned with the response object?
My current attempt:
FB.ui({
method: 'stream.publish',
message: message,
display: 'popup', // force popup mode
data: "shared_item_id=96"
},
开发者_如何学Pythonfunction(response) {
alert('Post was published.' + response.share_item_id);
});
Is there away to get that shared_item_id into the response object?
I think you can resolve it by using closures:
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*/)
);
精彩评论