ajax问题?with activexobjects

san*_*ers 5 php ajax activex

我一直收到以下错误:

未捕获的异常:[Exception ..."组件返回失败代码:0x80004005(NS_ERROR_FAILURE)[nsIXMLHttpRequest.send]"nsresult:"0x80004005(NS_ERROR_FAILURE)"位置:"JS frame :: http:// site/cms/js/interface .js :: doAjaxCall :: line 300"数据:否]

 

未捕获的异常:[Exception ..."组件返回失败代码:0x80004005(NS_ERROR_FAILURE)[nsIXMLHttpRequest.send]"nsresult:"0x80004005(NS_ERROR_FAILURE)"位置:"JS frame :: http:// site/cms/js/interface .js :: doAjaxCall :: line 300"数据:否]

第0行

这是doAjaxCall的功能

function doAjaxCall(cmd,params) {
  var postdata='cmd='+cmd+'&params='+params;

  var a=sajax_init_object();
  if (a) {
    a.open("POST","ajax_handler.php", false);
    a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    a.send(postdata);                      <====Line 300
      document.body.style.cursor="default";

    if(a.readyState == 4) {
      return a.responseText;
    } else {
      alert("We where unable to execute the ajax call.");
    }
  }

function sajax_init_object() {
    var A;
    try {
        A=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            A=new ActiveXObject("Microsoft.XMLHTTP");
        } catch (oc) {
            A=null;
        }
    }
    if(!A && typeof XMLHttpRequest != "undefined")
        A=new XMLHttpRequest();
    if (!A)
        alert("Could not create connection object.");
    return A;
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

小智 1

由于 Javascript 中的安全限制,无法通过 XMLHttpRequest 从远程域检索信息。我想你需要一个代理!