So, I'm currently using a Facebook login button API. What I wanted to do was for my code to add the user's email after the user logged in, into the SQL database. I'm having trouble understanding how to access the information of the email in the PHP code. This is all done on an HTML page but the HTML page doesn't hold variables and I tried running the javascript function to no avail. Part of my code is
function returnEmail() {
var url = '/me?fields=name,email';
var email = '';
FB.api(url, function(response) {
console.log('Successful calls email function');
email = response.email;
});
return email;
}
This essentially returns a string variable that represents the email value. I'm not familiar enough with PHP and how it interacts with Javascript to understand how I can get that email information and then add it. Thanks if you can provide any help!