Skip to content

Instantly share code, notes, and snippets.

@njvitto
Created September 8, 2011 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njvitto/1203139 to your computer and use it in GitHub Desktop.
Save njvitto/1203139 to your computer and use it in GitHub Desktop.
Useful script to ask Facebook social graph for how many likes gived an URL
<script type="text/javascript">
FB.api('/', {id: "<%= @url_for_FB %>"} ,function(response) {
fb_shares = "0";
if(typeof(response.shares)!=='undefined' && response.shares!=null)
fb_shares = response.shares;
$("FB_shares").update(fb_shares);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment