Uncaught TypeError: Illegal invocation
I'm having this error when trying delay all ajax requests in my application.
(function(send) {
XMLHttpRequest.prototype.send = function(data) {
setTimeout( function () {
send.call(this, data); //Error here
},3000);
};
})(XMLHttpRequest.prototype.send);
Could you give me some hints? Thanks in advance.