从Facebook Bug

时间:2015-06-23 21:52:50

标签: javascript jquery ajax facebook

我一直在处理的脚本已经过全面测试并且可以正常运行,也就是针对Gal_All,Gal_S_1,Gal_S_2和Gal_S_3的测试网址设置,这些网页通常是Google共享的页面。 co.uk和YouTube.co.uk。

代码段

var APIUrl = 'https://graph.facebook.com/?ids=' + Gal_All + ',' + Gal_S_1 + ',' + Gal_S_2 + ',' + Gal_S_3;
var CommentsCount = 0;
var ShareCount = 0;

$.ajax({

    async: false,
    url: APIUrl,
    dataType: "json",
    success: function(json) {
        for (var key in json) {
            CommentsCount += json[key]["comments"];
            ShareCount += json[key]["shares"];
        }
    },
    error: function() {
        alert("Some error occured");
    },
});
alert('Share count: ' + ShareCount + 'and Comment Count: ' + CommentsCount);

所以现在我已经更换了所有测试链接,并推测所有工作。在展示演示时,我想再次更改其中一个指向Google.co.uk的链接,并且发现如果任何链接尚未收到任何评论或链接,但结果将最终为NaN。< / p>

0 个答案:

没有答案