我只有一个文本域,用下面的方法提交表单,文本域字符长度为200可以提前,当为300时就不知道发生什么情况了,反正没有数据有没有办法解决这事
看代码:function ajaxSubmit(myurl){
var name = document.getElementById('content').value;
//创建XMLHttpRequest对象
var xmlhttp
try{
xmlhttp = new XMLHttpRequest();
}catch(e){
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
//创建请求结果处理程序
xmlhttp.onreadystatechange = function(){
if(4 == xmlhttp.readyState){
if(200 == xmlhttp.status){
var date = xmlhttp.responseText;
window.opener.location.reload();
window.close();
}else{
alert("error");
}
}
}
//打开连接,true代表异步提交
xmlhttp.open("post",myurl,true);
//当方法为POST时需要设置HTTP头
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
//发送数据
xmlhttp.send("content="+escape(name));
}
看代码:function ajaxSubmit(myurl){
var name = document.getElementById('content').value;
//创建XMLHttpRequest对象
var xmlhttp
try{
xmlhttp = new XMLHttpRequest();
}catch(e){
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
//创建请求结果处理程序
xmlhttp.onreadystatechange = function(){
if(4 == xmlhttp.readyState){
if(200 == xmlhttp.status){
var date = xmlhttp.responseText;
window.opener.location.reload();
window.close();
}else{
alert("error");
}
}
}
//打开连接,true代表异步提交
xmlhttp.open("post",myurl,true);
//当方法为POST时需要设置HTTP头
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
//发送数据
xmlhttp.send("content="+escape(name));
}
另外可以用HTTPWatch,或IEInspector等工具查看一下递交的数据是不是正确。
300个汉字不算大,总量超过了IIS的递交限制了吗?
另外可以用HTTPWatch,或IEInspector等工具查看一下递交的数据是不是正确。 Up
长夜漫漫 无心睡眠的人还真多呀!~~~~~~~~~
都说了,普通表单提交几千字都没问题,这样可以排除IIS限制了吧用AJAX提交表单,同样是汉字,只是一个多一个少,汉字多了就提交不了,这样也可以排除数据的正确性