Please take a look at the following code, what do you think will be the first magazine to be printed?
In Chrome and IE, "sync ajax call: success" first appears, which is expected
BUT in FF (tested in FF 3.6 and FF 17.0) instead shows "an asynchronous ajax call: success", which means that we make the second as a synchronous call, but when its onreadystatechange is started, the asynchronous (first) ajax call handler was made earlier than the synchronous (second) ajax call, does it make sense?
Isn't that a firefox bug?
// first ajax call, Note: this is asynchronous. $.ajax({ url: "/rest/someUrl", async : true, dataType : "json", contentType: "application/json", success : function(data) { console.log("async ajax call: success"); }, error : function(data) { } }) // second ajax call, Note: this is synchronous. $.ajax({ url: "/rest/someUrl", async : false, dataType : "json", contentType: "application/json", success : function(data) { console.log("sync ajax call: success"); }, error : function(data) { } })
source share