Jump to content

Recommended Posts

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

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.