Hi,
I wanted to extend XMLHttpRequest so that i could call another function in Onreadystatechange
here is code which is working in all browsers but IE7 and IE8
(function(open) {
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
this.addEventListener("readystatechange", function() {
if(this.readyState == "4"){myfunction();}
}, false);
open.call(this, method, url, async, user, pass);
};
})(XMLHttpRequest.prototype.open);
i changed it to this one to make it work in IE7 and IE8 but it doesn't work
(function (open) {
XMLHttpRequest.prototype.open = function (method, url, async, user, pass) {
this.attachEvent("onreadystatechange", function () {
if (this.readyState == "4") { Myfunction(); }
});
open.call(this, method, url, async, user, pass);
};
})(XMLHttpRequest.prototype.open);
but it's interesting that XmlHttpRequest doesn't support neither attachEvent nor addEventListener.
Thanks