English 中文(简体)
笔录
原标题:Parse facebook comments

我正试图对博爱基金会的评论发表看法。

 var url = http://graph.facebook.com/comments?id={{ url_of_the_page }}

我在利用j Query,试图从答复中获取data.id和其他物品:

 $j.getJSON(url, function (item) {            
        console.log(item);              
    });

However, they stick an URL object at the top, so it s:

item
 {{ url_of_the_page }}
     data 
         [0]
            id
            ...

我如何使用<条码>id和其他特性? item.{ url_of_the_page >,data 没有工作。

JSON样本:

  {
 "http://www.mysiteurl.com": {
  "data": [
     {
        "id": "10150212811760417_27834638",
        "from": {
           "name": "Tomas Tomas",
           "id": "100000606151004"
        },
        "message": "test",
        "created_time": "2011-11-22T14:21:42+0000"
     },
     {
        "id": "10150212811760417_27835460",
        "from": {
           "name": "Tomas Tomas",
           "id": "100000606151004"
        },
        "message": "ThanksGiving!",
        "created_time": "2011-11-22T14:51:23+0000"
     },
     {
        "id": "10150212811760417_27835931",
        "from": {
           "name": "Tomas Tomass",
           "id": "100000606151004"
        },
        "message": "3rd comment",
        "created_time": "2011-11-22T15:08:49+0000"
     }
  ],
  "paging": {
     "next": "https://graph.facebook.com/comments?ids=httpu00253Au00252Fu00252Fwww.mywebsite.com&limit=25&offset=25"
  }
  }
 }
最佳回答

引言

item["url_of_the_page"].data[0].id
问题回答

我与<代码>students.item [“http://www.myurl.com”].comments.data[i].id 选项 a bit. 最后,它使用<代码>students[”http://www.myurl.com]。

var students = {
    "http://www.myurl.com": {
        "comments": {
            "data": [
                {
                    "id": "123456778",
                    "from": {
                        "name": "Rohit",
                        "id": "1000005"
                    },
                    "message": "Hey ROhit",
                    "can_remove": false,
                    "created_time": "2012-09-03T03:16:01+0000",
                    "like_count": 0,
                    "user_likes": false
                }
            ]
        }
    }
}




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签