Reputation: 1695
In my rails app i have done facebook share like this..
<li class="facebook">
<a href="javascript: void(0)" onclick="window.open('https://www.facebook.com/dialog/feed?app_id=<%= FACEBOOK_APP_KEY %>&display=popup&description=<%= $fb_share_text %>&name=<%= $fb_share_name %>&picture=<%= request.base_url %>redirect_uri=<%= FB_CALL_BACK_URL %>','sharer','toolbar=0,status=0,width=548,height=325');"></a>
</li>
Can I do the same thing using jquery ajax call. Because i want to do something on the success function like updating some html.. Pls help..
Upvotes: 1
Views: 2874
Reputation: 3152
This SO answer covers sharing using the Facebook JavaScript API. Should be exactly what you're looking for. It has a callback on success as well.
The link to the Facebook Docs on FB.ui()
is here.
Some sample code from the page with the callback:
FB.ui(
{
method: 'share',
href: 'https://developers.facebook.com/docs/',
},
function(response) {
if (response && !response.error_code) {
alert('Posting completed.');
} else {
alert('Error while posting.');
}
}
);
Upvotes: 3