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

Related Posts