Reputation: 1063
I know how to intercept AJAX calls with XMLHttpRequest.
I looked at the docs and there is no mentioning of the parameters (POST body) .
How do I intercept those using XMLHttpRequest.
I'm trying to keep track of all the AJAX requests run on a web page.
Thanks!
Upvotes: 4
Views: 1800
Reputation: 1063
This is how you do it:
XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
var newSend = function(vData) { console.log("data: " + vData); this.realSend(vData); };
XMLHttpRequest.prototype.send = newSend;
Upvotes: 8