Skip to content

Instantly share code, notes, and snippets.

@Qiki
Created September 29, 2016 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qiki/62bb114f98048684faf0e0691cd6140b to your computer and use it in GitHub Desktop.
Save Qiki/62bb114f98048684faf0e0691cd6140b to your computer and use it in GitHub Desktop.
another way of ajax
//
//
//
//var s_ajaxListener = new Object();
//s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open;
//s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
//
//XMLHttpRequest.prototype.open = function(a,b) {
// if (!a) var a='';
// if (!b) var b='';
// s_ajaxListener.tempOpen.apply(this, arguments);
// s_ajaxListener.method = a;
// s_ajaxListener.url = b;
// if (a.toLowerCase() == 'get') {
// s_ajaxListener.data = b.split('?');
// s_ajaxListener.data = s_ajaxListener.data[1];
// }
//
// s_ajaxListener.callback();
//}
//
//XMLHttpRequest.prototype.send = function(a,b) {
// if (!a) var a='';
// if (!b) var b='';
// s_ajaxListener.tempSend.apply(this, arguments);
// if(s_ajaxListener.method.toLowerCase() == 'post')s_ajaxListener.data = a;
// s_ajaxListener.callback();
//}
//
//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)
//
// sendMessageToApp (this.data);
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment