readyState
readyState is a property used in web APIs to indicate the current loading status of a resource or document. In XMLHttpRequest, it represents the state of an asynchronous HTTP request with five possible values: 0 UNSENT, 1 OPENED, 2 HEADERS_RECEIVED, 3 LOADING, and 4 DONE. The value changes as the request progresses: 0 before open() is called, 1 after open(), 2 after a response header is received, 3 while the response body is downloading, and 4 when the operation completes. Developers often listen for the readystatechange event to react to state changes, and in the DONE state the response is available via xhr.response or xhr.responseText.
Separately, document.readyState reflects the loading state of the current document. It can be 'loading' while the