xmlhttp.open("post",str,true);问题?
function checkLink(){
alert("开始测试!");
var compareUrl="192.168.0.55";//document.getElementById("compareUrl");
var compareServiceName="orcl";//document.getElementById("compareServiceName");
var comparePort="1521";//document.getElementById("comparePort");
var compareUserName="he121";//document.getElementById("compareUserName");
var comparePass="he121";//document.getElementById("comparePass");
var str = pa+"/testLink.do?compareUrl="+compareUrl+"&compareServiceName="+compareServiceName+"&comparePort="+comparePort+"&compareUserName="+compareUserName+"&comparePass="+comparePass;
alert("sfd"+str);
xmlhttp.open("post",str,true); //这里前台报:Uncaught TypeError: Cannot call method 'open' of undefined xmlhttp.send(null);
alert(" 测试成功!");
window.close();
}
------解决方案--------------------你的xmlhttp的定义呢?
------解决方案--------------------
post方式的话,url中是不带参数的,将你的post提交页面地址与你的参数分离开来
JScript code
xmlhttp.open("POST", "testLink.do", true);
xmlhttp.setRequestHeader("Content-Length",str.length);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(str);
------解决方案--------------------
你写了createXMLHttpRequest函数,但很怀疑你有没有调用
而且既然用的全局变量,还要返回值做什么
function checkLink(){
createXMLHttpRequest();
......
}
这样再试试吧