Change your js file to this:
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'' + response.name + '!';
$.ajax({
type: 'POST',
url: 'result.php',
data: {name: response.name },
success: function(msg) {
console.log(msg);
}
});
});
}
And change your php file to this:
<?php
print_r($_POST);
?>
and then go to the console and search for the name variable, if you can find the name
variable then all things is fine.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…