0

我正在使用 Facebook 评论插件,我想处理评论创建事件以在服务器端执行一些 ajax 操作。

我的代码(头标签):

    <script>
  window.fbAsyncInit = function() {
        FB.init({
          appId      : 'App_ID', // App ID
          channelURL : '//www.dealaumaroc.com/channel.html', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          oauth      : true, // enable OAuth 2.0
          xfbml      : true  // parse XFBML
        });
        console.log('fb init');
          FB.Event.subscribe('comment.create', function(response)
                  {
                    alert(response);
                    console.log(response);
                  });
          FB.Event.subscribe('comment.remove',
            function (response) {
                alert('remove', response);
                console.log(response);
            });
      };

      // Load the SDK Asynchronously
      (function(d){
         var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/en_US/all.js";
         d.getElementsByTagName('head')[0].appendChild(js);
       }(document));
</script>

html代码:

<fb:comments href="http://www.dealaumaroc.com/dolo/${deal.path}" num_posts="2" width="470" notify="true"></fb:comments>

当我添加评论时,评论添加成功,但未处理事件。我发现很多关于这个问题的帖子,我使用了相同的代码,我看不出为什么?

4

0 回答 0