xmlHttp传送参数的问题
<script type= "text/javascript ">
function GetResult()
{
var xmlhttp;
var strResult;
var prefixes = [ "MSXML3.XMLHTTP ", "MSXML2.XMLHTTP ", "Microsoft.XMLHTTP ", "MSXML.XMLHTTP ", "Msxml2.XMLHTTP.5.0 ", "Msxml2.XMLHTTP.4.0 ", "Msxml2.XMLHTTP.3.0 "];
if (window.ActiveXObject)
{
for(var i=0;i <prefixes.length;i++)
{
try
{
xmlhttp=new ActiveXObject(prefixes[i]);
break;
}
catch (e)
{
}
}
}
else if (window.XMLHttpRequest)
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch (e)
{
alert( "你的浏览器不支持XMLHttpRequest对象,请升级 ");
}
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
strResult=xmlhttp.responseText;
}
};
xmlhttp.open( "GET ", "dataread.jsp ",false);
xmlhttp.send(null);
};
</script>
<form method=post action= 'datadisplay.jsp '>
<input type=hidden name=action value= "sta ">
<input type=submit name=suboper value= "静态数据 ">
</form>
上面的代码本身正确,但我想给dataread.jsp传递一个参数,比如:上面隐藏控件action的值“sta”,(这两段代码在同一页面),该怎么修改上面的程序,我用
xmlhttp.send( "sta ");却不正确,该怎么写请高手指教!
------解决方案--------------------得到参数就request.getParameter( "xxx ")啊
xmlhttp.open( "GET ", "http://url ", true);这样传