By convention, we name the XMLHttpRequest variable xhr.
var xhr = new XMLHttpRequest();
xhr.open("GET", "/articles/javascript-xmlhttprequest-a-simple-get-example/book.json");
xhr.onreadystatechange = function () {
console.log("readyState = " + this.readyState + ", status = " + this.status);
if (this.readyState == 4 && this.status == 200) {
var result = this.responseText;
console.log(result);
}
};
xhr.send();