readyState

VALORE STATO DESCRIZIONE
0 UNSENT  
1 OPENED Il metodo open()è stato chiamato
2 HEADERS_RECEIVED Il metodo send() è stato chiamato
3 LOADING  
4 DONE L'operazione è stata completata

response

var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.chucknorris.io/jokes/random");
xhr.addEventListener("readystatechange", function () {
	if (this.readyState === this.DONE) {
		console.log(this.response);
	}
});
xhr.send();

responseText

responseType

responseURL

responseXML

status / statusText

var xhr = new XMLHttpRequest();
console.log(xhr.status); //0
console.log(xhr.statusText); //""
xhr.open("GET", "https://api.chucknorris.io/jokes/random");
console.log(xhr.status); //0
console.log(xhr.statusText);""
xhr.addEventListener("readystatechange", function () {
    console.log(this.readyState, xhr.status, xhr.statusText);
    //2 200 ""
    //3 200 ""
    //4 200 ""
});
xhr.send();
console.log(xhr.status); //0
console.log(xhr.statusText); //""

timeout

upload

withCredentials