I have several lines of code that I want to run atomically (no context switches to other code). Please look at the following barebones example that illustrates the issue:
//========================= function doAjax() { console.info('making request'); new Ajax.Request( url, { onSuccess: function() { console.info('success'); }, onFailure: function() { console.info('failure'); }, onComplete: function() { console.info('complete'); } } ); } doAjax(); doAjax(); //========================= If the processor is "faster" than the network, I expect the output to be : making request making request success complete success complete However, under certain conditions, success+complete is sometimes not atomic. Here's some output that I have seen: (A) making request (A) success (B) making request (A) complete (B) success (B) complete This is against my expectations and breaks my code logic - the website fails to function when complete does not IMMEDIATELY follow success. Can someone shed some light on why this is happening? I thought AJAX is only asynchronous while waiting for the server and should become synchronous as it's executing the callback code... -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.