Facebook – Like Count / Comment Count using Javascript

In facebook, we can get the post/photo/video URL  like count / comment count / other information from graph.facebook.com.

It returns the entire object and we display the like count / comment count in our example.

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js”></script&gt;
<script language=”javascript” type=”text/javascript”>
//var url = ‘http://graph.facebook.com/?id=https://www.facebook.com/photo.php?fbid=199800716810262&set=a.172810786175922.5839.172632706193730&type=1&theater&#8217;;
var url = ‘http://graph.facebook.com/199800716810262&#8217;;
url: url,
dataType: ‘jsonp’,
success: function(data) {
document.write(“Like Count:”+data.likes.data.length);
document.write(“\nComment Count:”+data.comments.data.length);




Thanks to: http://stackoverflow.com/questions/14813457/facebook-graph-returns-same-like-share-comment-count-for-several-pages


About selvam4win

I am Selvam. I am very jolly person and frank one.

Posted on May 28, 2013, in Facebook, FQL, jQuery and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: