I am trying to login using facebook JS, I am using the following code :
function FBLogin() {
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
//alert(response);
jQuery.ajax({
url: 'someurl.php',
type: 'POST',
data: 'id=' + response.id + '&firstname=' + response.first_name + '&last_name=' + response.last_name + "&email=" + response.email,
dataType: 'json',
success: function(data, textStatus, xhr) {
$(document).ajaxStop(function() {
setTimeout("window.location = 'otherpage.html'", 100);
});
},
error: function(xhr, textStatus, errorThrown) {
alert(textStatus.reponseText);
}
});
//window.alert(response.last_name + ', ' + response.first_name + ", " + response.email);
});
}
}, {
scope: 'email'
});
}
In this I have a ajax call, I want to reload the page after the ajax success. In someurl.php
, I am just echo some text, I want to reload
the page after the ajax success.
I have tried
success: function(data, textStatus, xhr) {
$(document).ajaxStop(function(){
setTimeout("window.location = 'otherpage.html'",100);
});
},
and
success: function(data, textStatus, xhr) {
window.location.reload();
},
but none of code is working. Please help me. How can I reload the page when the ajax is successful?
Aucun commentaire:
Enregistrer un commentaire