现有网站A 和 网站B A 向B网站POST xml格式的字符串 方法如下:
function ExecServerPrgm(strPrgmURL, strMethod, strParamString, strUserID, strPwd)
{
try{
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
if (strUserID != "" && strUserID != null)
xmlhttp.Open(strMethod, strPrgmURL, false, strUserID, strPwd);
else
xmlhttp.Open(strMethod, strPrgmURL, false);
if (strMethod.toUpperCase() == 'POST'){
xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.Send(strParamString);
}
else{
xmlhttp.Send();
}
if (xmlhttp.status == 200)
return unescape(xmlhttp.responseText);
else
return -1;
}catch(e){
alert(e.message);
return -1;
}
}
function NewsXMLParamString()
{
//发送的XML
var strInfoPropsXmlString =document.getElementById("TextArea1").innerText;
var strURL = 'http://193.193.193.189 /SYSParts/InfoFlow/InfoToExGi.aspx';
var strResult = ExecServerPrgm(strURL, 'POST', 'param='+strInfoPropsXmlString);
if (strResult == -1){
alert ('执行该操作时出现异常,可能您的登录已经失效,请重新登录后重试!');
}else{
if (strResult.toUpperCase().indexOf("TRUE")>-1){
alert ('操作执行成功');
window.returnValue = strResult;
closeCurWindow();
}else{
alert(strResult.toUpperCase());
alert ('信息上传未正确执行。请稍后再试。');
}
}
}在执行的时候报“没有权限”,查资料后 修改安全设置 允许跨域访问数据,但又报
The system cannot locate the resource specified
不知道怎么解决?????
请高手帮忙
function ExecServerPrgm(strPrgmURL, strMethod, strParamString, strUserID, strPwd)
{
try{
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
if (strUserID != "" && strUserID != null)
xmlhttp.Open(strMethod, strPrgmURL, false, strUserID, strPwd);
else
xmlhttp.Open(strMethod, strPrgmURL, false);
if (strMethod.toUpperCase() == 'POST'){
xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.Send(strParamString);
}
else{
xmlhttp.Send();
}
if (xmlhttp.status == 200)
return unescape(xmlhttp.responseText);
else
return -1;
}catch(e){
alert(e.message);
return -1;
}
}
function NewsXMLParamString()
{
//发送的XML
var strInfoPropsXmlString =document.getElementById("TextArea1").innerText;
var strURL = 'http://193.193.193.189 /SYSParts/InfoFlow/InfoToExGi.aspx';
var strResult = ExecServerPrgm(strURL, 'POST', 'param='+strInfoPropsXmlString);
if (strResult == -1){
alert ('执行该操作时出现异常,可能您的登录已经失效,请重新登录后重试!');
}else{
if (strResult.toUpperCase().indexOf("TRUE")>-1){
alert ('操作执行成功');
window.returnValue = strResult;
closeCurWindow();
}else{
alert(strResult.toUpperCase());
alert ('信息上传未正确执行。请稍后再试。');
}
}
}在执行的时候报“没有权限”,查资料后 修改安全设置 允许跨域访问数据,但又报
The system cannot locate the resource specified
不知道怎么解决?????
请高手帮忙
但不能获取返回值
什么意思? 那怎么判断POST是否成功啊