I am trying to get a notification when an user comments using the social plugin. The code is as following:
<fb:comments href='someurl' width='400'></fb:comments>
FB.Event.subscribe('comment.create', function(response)
{
alert(response);
}
Simple, but it's not working. Someone got some possible errors? From my research online, it seems as if the notification has no real consistency. Sometimes it works, sometimes it doesn't.
Add the notify="true"
attribute to the fb:comments
tag.
<fb:comments notify="true" href='someurl' width='400'></fb:comments>
FB.Event.subscribe('comment.create', function(response)
{
alert(response);
}
why not to close the function call?
FB.Event.subscribe('comment.create', function(response)
{
alert(response);
});
I was having the same issues until I stumbled upon this answer here:
Methods subscribed via FB.Event.subscribe to comment.create or comment.remove are not triggered
You should put everything related to FB.[...] functions (FB.init, FB.Event.suscribe, ...) in
window.fbAsyncInit = function(){ // Your code });
Otherwise your code will be parsed before the FB js sdk has been fully loaded and you will >never really suscribe to your event
That might be obvious to a lot of people but for me and others who are new to this that might trip you up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With