Skip to content

Instantly share code, notes, and snippets.

@andershaig
Created November 9, 2011 01:10
Show Gist options
  • Save andershaig/1349982 to your computer and use it in GitHub Desktop.
Save andershaig/1349982 to your computer and use it in GitHub Desktop.
Facebook Post to Wall w/ Variable Share Link
<script type="text/javascript">
jQuery(document).bind('afterfbinit', function () {
// The ID of your share button or link
$('#share_button').live('click', function () {
FB.ui({
method: 'feed',
name: 'Title of Share Info',
description: 'Description under title in Share Info',
picture: 'Link to an image (90 by 90px)',
link: 'http://www.facebook.com/pages/@/{{ fb.page.id }}'
}, function (param) {
// If they cancel params will show:
// {action:false, ...}
// and if they send the friend request it'll have:
// {action:true, ...}
// and if they closed the pop-up window then:
// param is undefined
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment