使用javascript进行异步提交数据比直接使用现成的AJAX控件效率高很多(我只使用过ajax.net)
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/webkaifa/)实验发现可以提交大容量数据——实验到40K左右
function doSubmit()
{
.......
var urlParameter="cfg="+urlPara1
+"&type="+vkeytype
+"&starttime="+vstarttime
+"&endtime="+vendtime
+"&subject="+vsubject;
//alert(vsubject);
//return;
if (typeof XMLHttpRequest != 'undefined')
{
httpRequest3 = new XMLHttpRequest();
}
else if (typeof ActiveXObject != 'undefined')
{
httpRequest3 = new ActiveXObject('Microsoft.XMLHTTP');
}
if (httpRequest3)
{
httpRequest3.open('POST', "/后台页面.aspx", true);//true为异步
httpRequest3.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest3.onreadystatechange=onComplete;
httpRequest3.send(urlParameter);
}
currentPage=n;
return;
}
function onComplete()
{
if(4==httpRequest3.readyState)
{
//alert(httpRequest3.responseText);
if(200==httpRequest3.status)
{
var retText=httpRequest3.responseText;
document.getElementById("mainlist").innerHTML=retText;
}
}
}