Javascript获取图facebook数组查询
Javascript get graph facebook array query
大家好,
今天我在 Javascript FB Graph 上堆叠,我尝试获取计数份额,例如从 url 分享到 facebook,使用 Ajax 作为我下面的代码。有可能这样做吗?或者还有其他方法吗?谢谢。
var api_fb_ul = "https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://855read.com/article/category/global/id/97.html'";
$.getJSON(api_fb_ul, function(data){
alert(data['like_count']);
});
当我们转到地址 api_fb_ul 时,它向我们展示了下面的数组:
{
"data": [
{
"url": "http://855read.com/article/category/global/id/97.html",
"normalized_url": "http://www.855read.com/article/category/global/id/97.html",
"share_count": 812,
"like_count": 5578,
"comment_count": 838,
"total_count": 7228,
"commentsbox_count": 17,
"comments_fbid": "1196527890387837",
"click_count": 0
}
]
}
您需要进一步探索回复:)
您可以通过以下方式访问您想要的内容:
var api_fb_ul = "https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://855read.com/article/category/global/id/97.html'";
$.getJSON(api_fb_ul, function(response) {
console.log(response.data[0].like_count);
});
显示全部keys/values:
$.getJSON(api_fb_ul, function(response) {
Object.keys(response.data[0]).forEach(function(key, index) {
console.log(key, response.data[0][key]);
});
});
大家好,
今天我在 Javascript FB Graph 上堆叠,我尝试获取计数份额,例如从 url 分享到 facebook,使用 Ajax 作为我下面的代码。有可能这样做吗?或者还有其他方法吗?谢谢。
var api_fb_ul = "https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://855read.com/article/category/global/id/97.html'";
$.getJSON(api_fb_ul, function(data){
alert(data['like_count']);
});
当我们转到地址 api_fb_ul 时,它向我们展示了下面的数组:
{
"data": [
{
"url": "http://855read.com/article/category/global/id/97.html",
"normalized_url": "http://www.855read.com/article/category/global/id/97.html",
"share_count": 812,
"like_count": 5578,
"comment_count": 838,
"total_count": 7228,
"commentsbox_count": 17,
"comments_fbid": "1196527890387837",
"click_count": 0
}
]
}
您需要进一步探索回复:)
您可以通过以下方式访问您想要的内容:
var api_fb_ul = "https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://855read.com/article/category/global/id/97.html'";
$.getJSON(api_fb_ul, function(response) {
console.log(response.data[0].like_count);
});
显示全部keys/values:
$.getJSON(api_fb_ul, function(response) {
Object.keys(response.data[0]).forEach(function(key, index) {
console.log(key, response.data[0][key]);
});
});