Confused - my XMLHttpRequest has ReadyState 0 and status 200

I set a breakpoint in firebug and check my xhr object. ReadyState is 0, its status is 200. As far as I understand, if the status is 200, the request should be launched at least, and the ready state should be at least 1. Can someone explain what is happening?

I am using jquery $ .ajax to create an xhr object, but I don’t think it will affect the state and state of xhr.

+3
source share
2 answers

The request is complete when readyState is 4, and not when state 200.

+3
source

w3c , readyState xmlhttprequest. 0- > 4 (Uninitialized, Open, Sent, Recieving, Loaded), . , onreadystatechange, , .

spec status , ( ), , .

+4

Source: https://habr.com/ru/post/1704161/


All Articles