Getting Facebook Cover Page Image using jQuery

Today I am going to tell how to get facebook cover page image using jQuery code.

By using FB username, You will get user’s cover page image easily with jQuery Ajax jQuery.getJSON()

This method will Load JSON-encoded data from the server using a GET HTTP request.

Getting Facebook Cover-Page using jQuery
Getting Facebook Cover-Page using jQuery

jQuery Code to fetch Facebook Cover Page

	  jQuery.getJSON('http://graph.facebook.com/'+username+'?fields=cover&callback=?', function(data){
if(data.cover) {
jQuery('#cover-page').html('<img src="'+ data.cover.source + '">');
} else if(data.error) {
alert(data.error.message);
} else {
alert('No Cover Page Found');
}

});

Please don’t forget to share and subscribe to latest updates of the blog. Also any comments and feedback are all welcome!

Thanks!

View Live Demo

You May Also Like

Never Miss Any Web Tutorials, Guides, Tips and Free eBooks

Join Our Community Of 50,000+ Web Lovers and get a weekly newsletter in your inbox

 

I hate spam too. Unsubscribe at any time.

1 thought on “Getting Facebook Cover Page Image using jQuery”

  1. This realy intersting!
    You think this solve with profile page?
    So I start tyeping my friend or page name and this turn to facebook profile link, and when I mouseOver for link, this sow my friend cover?

    Reply

Leave a Comment