Created
September 29, 2016 15:48
-
-
Save Qiki/62bb114f98048684faf0e0691cd6140b to your computer and use it in GitHub Desktop.
another way of ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// | |
//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