Return variable FB.ui returned in the response variable in the callback

I am using the Facebook SDK FB.ui. Can I pass a parameter using FB.ui so that it returns with the response object?

My current attempt:

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); }); 

Is it possible to get this shared_item_id in the response object?

+4
source share
1 answer

I think you can solve this problem 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*/) ); 
+5
source

All Articles