서버로 요청을 수행할 때 XHR객체의 readyState, status 상태값의 변화는 다음과 같다

See the Pen xhr-state by Song, MinGu (@min9nim) on CodePen.


readyState 값을 통해 요청의 진행 단계를 확인할 수 있다

Value State Description
0 UNSENT Client has been created. open() not called yet.
1 OPENED open() has been called.
2 HEADERS_RECEIVED send() has been called, and headers and status are available.
3 LOADING Downloading; responseText holds partial data.
4 DONE The operation is complete.


Ref.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState