Possible Duplicate:
How to return AJAX response Text?
Variable doesn’t get returned JQuery
AJAX not updating variable
I am having issue with this code:
/**
* facebook Object*/
var fbObject = new Object();
/**
* Function to get login status
* @returns boolean Logged in status
* */
fbObject.getLoginStatus = function() {
FB.getLoginStatus(function(response) {
if (response.status == 'connected') {
console.log('logged in');
return true;
} else {
console.log('not logged in');
return false;
}
});
}
var status = fbObject.getLoginStatus();
alert('Status: '+ status);
My problem is that getLoginStatus method isn't returning the value.