Skip to content

Instantly share code, notes, and snippets.

View Petar-Luketina's full-sized avatar

Petar Luketina Petar-Luketina

  • Cleveland
  • 04:09 (UTC -04:00)
View GitHub Profile
@alecperkins
alecperkins / gist:3889507
Created October 14, 2012 19:03
Detect any XMLHttpRequests
// From: http://stackoverflow.com/questions/3596583/javascript-detect-an-ajax-event
var s_ajaxListener = new Object();
s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open;
s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
s_ajaxListener.callback = function () {
// this.method :the ajax method used
// this.url :the url of the requested script (including query string, if any) (urlencoded)
// this.data :the data sent, if any ex: foo=bar&a=b (urlencoded)
console.log(this.method);