onreadystatechange in Firefox
The onreadystatechange is, in theory, meant to fire whenever the ready state of the XMLHttpRequest object changes. The readystate goes (realistically) from 1 (loading request) to 4 (request complete). As you might expect, in practice different browsers have different behaviours.
Anyway, the bug: when loading one particular URL (using code very similar to this) only transition to state 1 was firing the onreadystatechange event. Using Firebug you could see the GET request going out and the correct data coming back, so the request was being fulfilled. With other URLs everything worked as it should.
The fix was to set up the onreadystate change handler after opening and sending.
http = new xmlhttprequest object, etc. etc.Don't have a clue why...
http.open('get', editUrl);
http.send(null);
http.onreadystatechange = handleEditResponse();
Labels: firefox, javascript, onreadystatechange, xmlhttprequest
Anonymous
Anonymous
LIMS/Bioinfo programmer
Anonymous
. This post has trackbacks.
