Question:

In my page, I have the XFBML version of the "Like" button, I want to do something when the user clicks on it. How can I know that the user has clicked on it?

 

 

 

Answer:

Appreciate if you can like this page if you find it useful! - Click "Like"

To capture the "user click on the Like button", after initialising the JavaScript SDK, you can subscribe to the "edge.create" event. Sample code is given below:

 FB.Event.subscribe('edge.create', function (a) {
     doSomething()
 });

 

 

Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!