I'm just wondering what might happen if, during an ajax call, a request appears in the browser window to the user.
Say for example that I have an ajax call
$.ajax({ url: ..., type: GET/POST, ... success: function(data){ console.log(data); }, error: ... });
which takes a lot of time (10 seconds). While the call is in progress, a simple javascript warning is issued.
alert("hello!");
What happens, for example, if:
- ajax call starts
- Getting ajax call data
- warning is displayed
- ajax call returns data (warning window still open!)
Knowing that JS is a single thread, I know that the script will be stopped, I am just wondering what will happen to the ajax call / response if the warning window is not closed "in time".
Hope I was clear enough and that this is not a "dummy" question. Thanks you
javascript ajax single-threaded
BeNdErR May 22 '14 at 8:19 2014-05-22 08:19
source share