We are making multiple ajax requests to \"save\" data in a web app, then reload the page. We have run into a situation where (since requests are made asynchronously) the pa
it depends on way you do your requests For example (you don't do form submit. Otherwise you need prevent form submission)
$.ajax({
url: 'some_url',
type: 'GET',
data: 'var1=value1&var2=value2',
success: function(){
//do smth
},
error: function(){
alert(w.data_error);
document.location.reload();
}
complete: function(){ //A function to be called when the request finishes (after success and error callbacks are executed) - from jquery docs
//do smth if you need
document.location.reload();
}
});
Take a look onto complete block