任何帮助将深深感激,因为我已经尝试了所有我能想到的事情来实现这一目标,但无济于事。Facebook的新fb:评论和FB.Event.subscribe'comments.create'不工作
我正在使用Facebook的更新(截至上周)FB:评论系统,但无法获得FB.Event.subscribe'comments.create'和FB.Event.subscribe'comments.remove'的工作。
有问题的网页可以看到here。
我异步初始化FB:
<script type="text/javascript">
//<![CDATA[
window.fbAsyncInit = function() {
FB.init({appId: '191116444251564', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('comments.create', function (response) {
// console.log('create', response);
//got response.... now query FQL to return total number of post counts
FB.api(
{
method: "fql.query",
query: "SELECT count FROM comments_info WHERE xid='2_plain-basmati-rice---rice-cooker' and app_id='191116444251564'"
},
function(fql_response) {
$j.post('/recipes/2_plain-basmati-rice---rice-cooker/commented', {count: fql_response[0].count});
}
);
});
FB.Event.subscribe('comments.remove', function (response) {
//got response.... now query FQL to return total number of post counts
// console.log('remove', response);
FB.api(
{
method: "fql.query",
query: "SELECT count FROM comments_info WHERE xid='2_plain-basmati-rice---rice-cooker' and app_id='191116444251564'"
},
function(fql_response) {
$j.post('/recipes/2_plain-basmati-rice---rice-cooker/commented', {count: fql_response[0].count});
}
);
});
};
(function() {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
//]]>
</script>
用一个简单的警报( 'TST')不工作更换两个订阅回调。
我已经使用FB的linter测试了该页面,并且没有显示该特定页面的错误。
再次,我要感谢任何人可以提供任何提示或指针。
我注意到你正在使用'SELECT count FROM comments_info WHERE ...'。这实际上是否有用于获得评论数量? – TMC 2011-04-27 11:38:55
它曾经是我在大约一个月左右测试代码的时候......但是就Facebook的API而言,一个月就像100年一样,所以很有可能它不再有效......我?苦? FU *%$ * F! – Nazar 2011-04-28 19:43:45