日期:2014-05-16  浏览次数:20334 次

chrome浏览器load方法不能加载
又没有方法直接判断浏览器确定XMLHttpRequest对象.
或者
function createXmlHttpRequest(){ //创建对象
    try{
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e2){
        xmlHttp = false;
      }
    }
    if(!xmlHttp && typeof XMLHttpRequest != "undefined")
    {
      xmlHttp = new XMLHttpRequest();
    }  
  }这样的方法在jquery中怎么用呢.

------解决方案--------------------
function createXmlHttpRequest(){
xmlHttp = window.XMLHttpRequest ? new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
}

创建是不会有问题的,可能问题还在于你后面的使用