FireFox bug with onreadystatechange
Saturday, May 24th, 2008Just ran into this bug in FireFox: https://bugzilla.mozilla.org/show_bug.cgi?id=412112. Basically, if you do a synchronous call on an XMLHttpRequest object, the onreadystatechange function is not called. So the following code doesn’t work.
var request = new XMLHttpRequest(); request.onreadystatechange = function () { if (request.readyState == 4) if (request.status == 200) alert('request successful') }; request.open("GET", "/index.html", false); /* the false here makes it synchronous * request.send(null);