views:

658

answers:

2

I'm trying to catch event when comment is sent. What am I doing wrong? I just want to update every user comment also to facebook group wall and that's why I need to catch the event.

<fb:comments numposts="10" ></fb:comments>   

FB.init and event catcher:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId  : 'sensored-app-id',
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });

    /* All the events registered */
    FB.Event.subscribe('comments.add', function (response) {
        // do something with response
        alert("comment added");
    });



  };

  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/fi_FI/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script>   
+2  A: 

Hi! You need to add notify="true" attribute to the fb:comments tag. Once you add the attribute the comments.add event begin to work.

<fb:comments numposts="10" notify="true"></fb:comments>
fabianadipolo
what the? how did you find this out? it's not documented.
Typeoneerror
A: 

how can i know the contents of the variable response. I at least need to know the user id or the comment itself or just the plain simple xid.

JasonDev

related questions