Does facebook Like Button return any value (PHP)?
I want to execute another function after user like my webpage.
Doe开发者_开发问答s facebook Like Button return any value like true or false. So I can perform any operation after ?
Or is there another alternative ??
You'll have to use the Javascript API to do this:
FB.Event.subscribe('edge.create',
function(response) {
console.log("Here is the response %o", response);
}
);
AFAIK, "FB Like" is JavaScript addon (not PHP), but you could bind JS event to like button, that would send some AJAX data to your server, notifying it, about usage of Like button. Even thou, I'm not sure about my answer.
You can subscribe to events edge.create and edge.remove they are used for tracking the firing of liking and unliking events respectively..
as a simple check add alert() in the response function to see if you got it right..
FB.Event.subscribe('edge.create', function(response) {
// A user liked the item, read the response and handle
alert("like event detected");
});
FB.Event.subscribe('edge.remove', function(response) {
// A user liked the item, read the response and handle
alert("unlike event detected");
});
精彩评论