Opalelement,
Hello again :)
When the readyState becomes 4, why would status remain at the default value 0?
And I don't quite understand what you mean "if the status changes from the 0, it can't go back"... if (xhr.status == 0) stands true, I can't tell if it has changed or not. And what if the http response is not "200 OK" after all?
Thanks.
Main Topics
Browse All Topics





by: OpalelementPosted on 2009-11-02 at 06:32:39ID: 25719609
Hello, as you can see I answered that other question so I will try to help with this :)
The status of the XMLHttpRequest for Webkit and Mozilla is, by default, 0. This 0 is only there before a request is sent. However, once a request is sent, it reurns as 200 to say it was successful. After this it can never go back to 0 without reloading the page.
The order can be like this:
1) Page loads, status is 0.
2) A request is sent using the object.
3) Status returns as 200.
IE sets the default to 200 instead of 0, but all the 0 is there for is basically a null to say nothing has happened yet.
Therefor, using the following code will not be any risk, as once the status changes from the 0 it can't go back.
Select allOpen in new window