php - Ajax 问题?与 activexobjects

标签 php ajax activex

我不断收到以下错误:

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://site/cms/js/interface.js :: doAjaxCall :: line 300" data: no]

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://site/cms/js/interface.js :: doAjaxCall :: line 300" data: no]

第 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;
}

有什么想法吗?

最佳答案

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

关于php - Ajax 问题?与 activexobjects,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/768210/

相关文章:

java - 在 PHP 查询中使用 Select 和 Update

连接 AJAX 表单的 jQuery 插件 - 必须提供错误回调

php - 表单、AJAX 和 PHP

google-chrome - 谷歌浏览器可以嵌入吗?

javascript - 使用新 PDF 文件重新加载对象内容

php - 使用 Greasemonkey 和 PHP 下载和上传

javascript - 单击语法错误 : identifier starts immediately after numeric literal

javascript - 如何跟踪AJAX调用并确定是否不再需要调用回调函数?

delphi - 导入的 ActiveX 控件是非可视的

PHP:如果使用 Heroku 托管,则获取真实的客户端 IP