/*
coded by Kae - http://verens.com/
use this code as you wish, but retain this notice
*/

function XMLHttpRequest() {
    
var i=0;
    
var url='';
    
var responseText='';
    
this.onreadystatechange=function(){
        
return false;
    }
    
this.open=function(method,url){
        
//TODO: POST methods
        this.i=++kXHR_instances; // id number of this request
        this.url=url;
        
var iframe=document.createElement('<iframe id="kXHR_iframe_'+this.i+'" type="text/plain" style="display:none"></iframe>');
        document.body.appendChild(iframe);
    }
    
this.send=function(postdata){
        
//TODO: use the postdata
        var el=document.getElementById('kXHR_iframe_'+this.i);
        el.src
=this.url;
        kXHR_objs[
this.i]=this;
        setTimeout('XMLHttpRequest_checkState('
+this.i+')',500);
    }
    
return true;
}
function XMLHttpRequest_checkState(inst){
    
var el=document.getElementById('kXHR_iframe_'+inst);
    
if(el.readyState=='complete'){
        
var responseText=window.frames['kXHR_iframe_'+inst].document.body.childNodes[0].data;
        kXHR_objs[inst].responseText
=responseText;
        kXHR_objs[inst].readyState
=4;
        kXHR_objs[inst].status
=200;
        kXHR_objs[inst].onreadystatechange();
        el.parentNode.removeChild(el);
    }
else{
        setTimeout('XMLHttpRequest_checkState('
+inst+')',500);
    }
}
var kXHR_instances=0;
var kXHR_objs=[];

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
猜你喜欢
  • 2021-11-16
  • 2022-02-25
  • 2021-12-03
  • 2022-02-14
  • 2021-07-17
相关资源
相似解决方案