I am having a problem trying to ‘like’ a photo using JQuery. I’ve tried .post, .ajax, and now using the FB.api post. When I run the script I don’t even get the error messages. This is what I have as a function when the ‘like’ button is clicked:
function like(postId) {
FB.api('/'+postId+'/likes', 'post', function(result) {
if (!result) {
alert('Error: No Response');
} else if (result.error) {
alert('Error: '+result.error.message+'');
} else {
if (result==true) {
$('#likeButton-'+postId).hide();
$('#unlikeButton-'+postId).show();
}
}
});
}
Any suggestions would be a great help as I’ve been searching through the FB api docs for hours!!
I figured it out, I had to write the function to be defined at parse-time rather than run-time(as the question is formatted)