Sourabh Dhiman

Sourabh Dhiman

  • NA
  • 323
  • 58.3k

Get Data using ajax.

Nov 5 2019 5:58 AM
var facebookGraphURL = "https://graph.facebook.com/v5.0/?fields=id%2Cfollows_count%2Cfollowers_count%2Cname%2Cmedia%2Cusername%2Cprofile_picture_url%2Cmedia_count&access_token=EAANaZBXDZCFEQBAI8AQRzaXkKhG37lyzezNXZCBLLaz1aQeoY0cxz4APIkBvpW4Gv2MskiQZCRwCp5H1NUi5rUqxUMBolZCsFHXjTvYmCObad1xD53Cm9r08WT0LbyZAwfM3ZCNB54JyHlmXsZBwIJFtSyE7emnaSZBurFKGeqJOIwSLXEHJvd72zDhCC35yPgkCgvPuCGZB8QCQZDZD";
$.ajax({
url: facebookGraphURL,
dataType: 'json',
success: function(data, id) {
$( '#output' ).html('Id: ' + data.id);
$( '#output1' ).html('Name: ' + data.name);
$( '#output2' ).html('Media_count: ' + data.media_count);
$( '#output3' ).html('Username: ' + data.username);
$('#output4').html('Followers_count: ' + data.followers_count);
$('#output5').html('Media :' + data.media);
 
It's me code  i have get data with facebookgraph api  . But i have face a problem. I have get media data i have show output this [Media :[object Object]. I want to show media id and data.Please solve this.

Answers (2)