How to create a Jquery function that works with Facebook API so that the content only is shown if the user has shared it?
If you're using the Javascript SDK to publish stories, show the content in the callback response when a user shares content successfully:
FB.ui(
{
method: 'feed',
name: 'Google',
link: 'http://www.google.com/',
picture: 'http://google.com/xyz.jpg',
caption: 'Google Logo',
description: 'Search away'
},
function(response) {
if (response && response.post_id) {
// YOUR CODE GOES HERE
// e.g.
$("#some_div").show();
}
});
Note: Make sure you have loaded the Facebook JS SDK and jQuery.
More about JS SDK here
精彩评论