// override XMLHttpRequest // source: https://gist.github.com/icodejs/3183154 var open = window.XMLHttpRequest.prototype.open, send = window.XMLHttpRequest.prototype.send; function openReplacement(method, url, async, user, password) { return open.apply(this, arguments); } function sendReplacement(data) { this.addEventListener('readystatechange', function() { // Catch response here }, false); return send.apply(this, arguments); } window.XMLHttpRequest.prototype.open = openReplacement; window.XMLHttpRequest.prototype.send = sendReplacement;