I was just wondering what could happen if, while an ajax call is being executed, an alert is prompted to the user, in the browser window.
Let's say, for example, that I have an ajax call
$.ajax({
url: ...,
type: GET/POST,
...
success: function(data){
console.log(data);
},
error: ...
});
that takes long time to complete (10 sec). While the call is executed, a simple javascript alert is thrown
alert("hello!");
What happens for example if:
- ajax call starts
- ajax call fetching data
- alert is shown
- ajax call returns data (alert window is still open!)
Knowing that JS is single threaded I know that the script execution will halt, I was just wondering what happens to the ajax call/response if the alert window is not closed "in time".
I hope I was clear enough and that this is not a "dummy" question. Thank you
window.alert
(after using them as mockup-messages/breakpoints during prototyping) to (drive) a custom function. – Soll