-2

Facebookのコメントを取得するためにjavascript APIを使用しています。

次のjson結果を取得していますが、それらを解析してページで使用するにはどうすればよいですか?

  {
      "id": "1234567891_2823098717038_3160191",
      "from": {
        "name": "User",
        "id": "1234567891"
      },
      "message": "comment only...",
      "can_remove": true,
      "created_time": "2012-05-05T07:43:11+0000"
    },
    {
      "id": "1234567891_2823098717038_3160281",
      "from": {
        "name": "User",
        "id": "1234567891"
      },
      "message": "just another comment...",
      "can_remove": true,
      "created_time": "2012-05-05T08:14:17+0000"
    },
    {
      "id": "1234567891_2823098717038_3160336",
      "from": {
        "name": "user2",
        "id": "56265654845454"
      },
      "message": "congratz dear :)",
      "can_remove": true,
      "created_time": "2012-05-05T08:29:05+0000"
    }
  ],
  "paging": {
    "next": "http://link.dddd"
  }
}

これをループして内容を表示するにはどうすればよいですか?

jQuery ソリューションは許容されます。

ありがとうございました。

4

2 に答える 2

1

使用JQuery.parseJSON: http://api.jquery.com/jQuery.parseJSON/

于 2012-05-05T08:51:35.507 に答える
0

assoc_data = jQuery.param(応答); // response はあなたの json です

$.ajax({ タイプ: "POST"、url: "submit_fb_data.php"、データ: assoc_data、成功: 関数(データ) {

//etc

}

});

  • >= 1.4のjqueryバージョンを使用していることを確認してください
于 2012-05-06T21:04:30.800 に答える