doforumda Posted October 2, 2011 Share Posted October 2, 2011 I am trying to get json data using facebook graph api through jquery. I am using the code below. I am trying to get json data using $.getJSON function but it displays this error in firebug NetworkError: 400 Bad Request - https://graph.facebook.com/me/home?access_token=mytoken here is my code <!DOCTYPE HTML> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"> </script> <script type="text/javascript" src="script/script.js"></script> <script> $(function(){ //$('fb').fbWall(); var url = "https://graph.facebook.com/me/home?access_token=mytoken"; var html = "<ul>"; $.getJSON(url, function(json){ //console.log(json); $.each(json.data, function(i,fb){ html += "<li>" + fb.id + "</li>"; }); }); html += "</ul>"; $('.fb').animate({opacity: 0}, 500, function() { $('.fb').html(html); }); $('.fb').animate({opacity:1}, 500); }); </script> <!-- <link type="text/css" rel="stylesheet" href="styles.css" /> --> <style> .fb { width: 400px; height: 400px; border:1px solid red; } </style> <title>title</title> </head> <body> <div class="fb"> </div> </body> </html> where am I making mistake? Link to comment https://forums.phpfreaks.com/topic/248282-how-to-get-data-from-facebook-graph-api/ Share on other sites More sharing options...
doforumda Posted October 2, 2011 Author Share Posted October 2, 2011 When I directly run graph api link i.e. "https://graph.facebook.com/me/home?access_token=mytoken" adding my access_token, in the browser then it shows this error { "error": { "message": "(#606) Queries for multiple source_ids require a non-zero viewer that has granted read_stream permission", "type": "OAuthException" } } any solution please? Link to comment https://forums.phpfreaks.com/topic/248282-how-to-get-data-from-facebook-graph-api/#findComment-1275014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.