The status will be 0 until a request is sent. After that the status code will be 200. Since it is the readystatechange event, it should be 200... However if it takes a second it may not get there.
What you can do is replace:
if (xhr.status == 200)
with:
if (xhr.status == 200 || xhr.status == 0)
Once it changes it shouldn't be possible for it to go back to 0, so it will still be okay for either one to be valid.
Main Topics
Browse All Topics





by: HonorGodPosted on 2009-06-29 at 15:05:56ID: 24740694
What is the value of readyState when status == 0?