我不断收到以下错误:
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+'¶ms='+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/