I want to make an ajax request to send some information and immediately after sending it (doesnt matter if I get an error/success) make a redirection (without waiting server response)
I was wondering if I do something like
$.ajax({
url:_myurl_,
timeout:500,
success:function(){document.location= _redirectUrl_},
error: function(){document.location= _redirectUrl_}
})
will work fine? Does adding a timeout wont cancel my request?
AJAX by definition is asynchronous. Just add location redirect code AFTER the ajax block, not Inside AJAX.
async: false in async Mode process are not wait to complete other process
Just do not implement any success handler.
So you could do ...
And since it is asynchronous, it will be non blocking and any code following this statement will be executing without waiting from the response from the server.