4 lines
646 B
JavaScript
4 lines
646 B
JavaScript
|
var AjaxManager=function(){};
|
||
|
AjaxManager.prototype={xhr:[],send:function(f,e,a,c){for(var d=0;d<this.xhr.length;d++)this.xhr=this.xhr.slice(0,d-1).concat(this.xhr.slice(d,this.xhr.length-1));var b=this.xhr.push(window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest"))-1;this.xhr[b].onreadystatechange=function(){4==this.xhr[b].readyState&&(-1<[0,200].indexOf(this.xhr[b].status)?e(this.xhr[b].responseText):e())}.bind(this);a="string"==typeof a&&/^POST|GET$/i.test(a)?a.toUpperCase():"POST";c="POST"==
|
||
|
a&&"object"==typeof c&&c instanceof FormData?c:null;this.xhr[b].open(a,f,!0);this.xhr[b].send(c);return this}};
|