I'm using the javascript sdk for facebook. I have a my own site specific "like" button, but want to check if the user is logged in before sending the request to the server. I used the fb.login() function as follows but whenever it gets called the page the "like" button is refreshed. Why does it get refreshed?
$('#like_id').click(function() {
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
return true;
} else {
// no user session available, someone you dont know
FB.login(function(response) {
if (response.session) {
return true;
} else {
return false;
}
});
}
});
});