适用于IE浏览器及非IE浏览器的xmlhttp脚本

这里记一下, 免得以后忘记了...
传说中来自google的脚本, 不知道是真是假

var xmlHttp=null
try 

    xmlHttp
=new ActiveXObject("Msxml2.XMLHTTP"
}
 
catch(e) 

    
try 
    

        xmlHttp
=new ActiveXObject("Microsoft.XMLHTTP"
    }
 
    
catch(oc)
    

        xmlHttp
=null 
    }
 
}

         
if ( !xmlHttp && typeof XMLHttpRequest != "undefined" ) 

    xmlHttp 
= new XMLHttpRequest() 
}
 
                 
 xmlHttp.open(
"POST", url, false);
 xmlHttp.send(
"");
 result 
= xmlHttp.responseText;
原文地址:https://www.cnblogs.com/index/p/277375.html