var xhr = new XMLHttpRequest(),
method = "GET",
url = "http://localhost:2998/";
xhr.open(method, url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
console.log(this);
};
};
xhr.send();
xhr.send(); //Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.
(function (open) {
XMLHttpRequest.prototype.open = function (method, url, async, fourth) {
console.log(fourth)
this.addEventListener("readystatechange", function () {
if (this.readyState == 4 && this.status == 200) {
console.log(this);
}
}, false);
open.call(this, method, url, async, fourth);
}
})(xhr.open);
xhr.open(method, url, true, 'fourth');
xhr.send();
xhr.open(method, url, true, 'fourth');
xhr.send();
) Найди 10 отличий