Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-02-2011, 06:59 PM   PM User | #1
doforumda
New Coder

 
Join Date: Oct 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
doforumda is an unknown quantity at this point
how to get data from facebook graph api using jquery

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

Code:
NetworkError: 400 Bad Request - https://graph.facebook.com/me/home?access_token=mytoken
here is my code

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?
doforumda is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:53 AM.


Advertisement
Log in to turn off these ads.