Skip to content

Instantly share code, notes, and snippets.

@muthuishere
Last active August 29, 2015 14:16
Show Gist options
  • Save muthuishere/eda84b463fbf8d93067c to your computer and use it in GitHub Desktop.
Save muthuishere/eda84b463fbf8d93067c to your computer and use it in GitHub Desktop.
Monitor All Ajax xmlhttp requests
//On connection Open , Ajax start
var _open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
var cururl=arguments[1]
_open.apply(this, arguments);
}
//On Ajax Complete
var _send = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function() {
/* Wrap onreadystaechange callback */
var callback = this.onreadystatechange;
this.onreadystatechange = function() {
if (this.readyState == 4) {
}
callback.apply(this, arguments);
}
_send.apply(this, arguments);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment