快速创建javascript中ajax通用函数

if( typeof XMLHttpRequeat == "undefined" )

 XMLHtppRequest = function(){

  //ie 用ActiveXObject

   //XMLHttpRequest对象

   

    return new ActiveXOject(

      navigator.userAgent.indexOf("MSIE5")>=0 ?  "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP" 

    );

};





//创建新的请求

 

var xml = new XMLHttpRequest();



//初始化请求

xml.open("GET","路径",true);



//建立连接并发送数据

xml.send();

你可能感兴趣的:(JavaScript)