web/wp-content/plugins/ajax-calendar/js/microajax.js
branchwordpress
changeset 109 03b0d1493584
equal deleted inserted replaced
-1:000000000000 109:03b0d1493584
       
     1 // MicroAJAX: http://www.blackmac.de/index.php?/archives/31-Smallest-JavaScript-AJAX-library-ever!.html
       
     2 function microAjax(url,cF){
       
     3 this.bF=function(caller,object){
       
     4 return function(){
       
     5 return caller.apply(object,new Array(object));
       
     6 }}
       
     7 this.sC=function(object) {
       
     8 if (this.r.readyState==4) {
       
     9 this.cF(this.r.responseText);
       
    10 }}
       
    11 this.gR=function(){
       
    12 if (window.ActiveXObject)
       
    13 return new ActiveXObject('Microsoft.XMLHTTP');
       
    14 else if (window.XMLHttpRequest)
       
    15 return new XMLHttpRequest();
       
    16 else
       
    17 return false;
       
    18 }
       
    19 if (arguments[2]) this.pb=arguments[2];
       
    20 else this.pb="";
       
    21 this.cF=cF;
       
    22 this.url=url;
       
    23 this.r=this.gR();
       
    24 if(this.r){
       
    25 this.r.onreadystatechange=this.bF(this.sC,this);
       
    26 if(this.pb!=""){
       
    27 this.r.open("POST",url,true);
       
    28 this.r.setRequestHeader('Content-type','application/x-www-form-urlencoded');
       
    29 this.r.setRequestHeader('Connection','close');
       
    30 }else{
       
    31 this.r.open("GET",url,true);
       
    32 }
       
    33 this.r.send(this.pb);
       
    34 }}