var url = 'https://graph.facebook.com/?ids=http://www.stackoverflow.com';
$.getJSON(url, function(resp) {
$("p").html('comments = ' + resp.comments);
});
这会将以下 html 放入我的<p>
:comments = undefined
我从调用中得到的返回字符串是这样的:
{
"http://www.thinlinebetween.com/tuesday-quote-of-the-day-jean-ingelow/": {
"id": "http://www.thinlinebetween.com/tuesday-quote-of-the-day-jean-ingelow/",
"shares": 2,
"comments": 1
}
}
我需要做类似的事情resp."http://www.thinlinebetween.com/tuesday-quote-of-the-day-jean-ingelow/".comments
来获得价值吗?返回的 json 不容易解析。谢谢!