I'm using Fb.login();
for login button and saving the info to the database like this.
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log(response);
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
var fname= response.first_name;
var lname= response.last_name;
var gender= response.gender;
var email= response.email;
var id= response.id;
$.ajax({
url: "save.php",
type: "POST",
dataType:'json',
data: {name: fname,email:email,gender:gender,id:id},
success: function(data){
console.log(data);
}
});
});
}
Above code works fine when the default button is used but not when using the custom button.
What I want to achieve is that the custom button should change the text inside the Response div and also change the like button to logged in format. What am I doing wrong here?