解析facebook json javascript
我正在使用javascript api获取facebook评论 我得到了以下json结果,但是我如何解析它们以在我的页面上使用呢解析facebook json javascript,javascript,jquery,facebook,json,Javascript,Jquery,Facebook,Json,我正在使用javascript api获取facebook评论 我得到了以下json结果,但是我如何解析它们以在我的页面上使用呢 { "id": "1234567891_2823098717038_3160191", "from": { "name": "User", "id": "1234567891" }, "message": "comment only...", "can_remove": t
{
"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解决方案是可以接受的
谢谢。使用JQuery.parseJSON:assoc_data=JQuery.paramresponse//其中响应是您的json $.ajax{ 类型:POST,, url:submit_fb_data.php, 数据:assoc_数据, 成功:functiondata{
//etc
}
})
确保使用>=1.4的jquery版本
我认为您缺少JSON响应副本的一部分,并将该JSON粘贴到任何JS编辑器中,您就会明白我的意思。看起来文档的开头被切掉了。@MK_Dev它现在工作了[json结果来自facebook,你最好向他们投诉+如果有常见的人为错误,我很抱歉]我以前尝试过搜索这个问题,我知道这个方法,但我不知道它是如何工作的,还是不工作的…请用你尝试过但没有工作的代码编辑你的问题。我用循环管理它,不需要jQuery。我接受你是因为我得了a-奖。继续!