XMLHttpRequest issues
Posted: Wed 23 Nov 2011 12:19 pm
Normally when I use the XMLHttpRequest object to perform a 'get' with javascript I use something like the following to check the response:In the past XMLHttpRequest.status has always returned an integer/numberbut I a now seeing a problem where the .status seems to be an error object!which of course messes up the above code - it creates an exception on the first test of status as I am performing a strict comparison.
As a work around I will change to loose comparison, but I cannot find any reference to this via Google. Anyone else seen it before?
Code: Select all
if (objXML.readyState === 4) { //complete?
if (objXML.status === 200) {
//do something
} else if (objXML.status > 200) {
//retry
}
}As a work around I will change to loose comparison, but I cannot find any reference to this via Google. Anyone else seen it before?