日期:2014-05-16  浏览次数:20898 次

用AJAX提交数据总是返回3,并且说有未指定错误. - Web 开发 / Ajax
var r1 =lei;
var r2 =document.getElementById("2").value;
var r3 =document.getElementById("3").value;
var r4 =document.getElementById("4").value;
var r5 =document.getElementById("5").value;
var r6 =document.getElementById("6").value;
var r7 =document.getElementById("7").value;
var r10 =document.getElementById("10").value;
var r11 =document.getElementById("11").value;
var r12 =document.getElementById("12").value;
var r13 =document.getElementById("13").value;
var r14 =document.getElementById("14").value;
var r15 =document.getElementById("15").value;
var r16 =document.getElementById("16").value;
var html = window.frames["Editor"].window.frames["HtmlEditor"].document.getElementsByTagName("BODY")[0].innerHTML;
 var html2=window.frames["Editor2"].window.frames["HtmlEditor"].document.getElementsByTagName("BODY")[0].innerHTML;
html = escape(html);
html2 = escape(html2);
r16 = escape(r16);
r1 = escape(r1);
r2 = escape(r2);
r3 = escape(r3);
r4 = escape(r4);
r5 = escape(r5);
r6 = escape(r6);
r7 = escape(r7);
r10 = escape(r10);
r11 = escape(r11);
r12 = escape(r12);
r13 = escape(r13);
r14 = escape(r14);
r15 = escape(r15);

var url = "r1=" +r1+ "&r2=" +r2+"&r3="+r3+"&r4="+r4+"&r5="+r5+"&r6="+r6+"&r7="+r7+"&r8="+html+"&r9="+html2+"&r10="+r10+"&r11="+r11+"&r12="+r12+"&r13="+r13+"&r14="+r14+"&r15="+r15+"&r16="+r16+"&time="+ new Date().toString();
 
request.open("POST", "person_upsend.asp", true); 
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
request.send(url); 
request.onreadystatechange = function (){ 
  if (request.readyState == 4) { 
  if (request.status == 200) { 

   
 document.getElementById('vts').innerHTML = "您的信息已经发布到首页";

  } 

  } 
 
else if (request.readyState == 3){
  document.getElementById('vts').innerHTML = "正在提交数据,请稍等......"; 
}
else if (request.readyState == 2){
  document.getElementById('vts').innerHTML = "已找到页面,准备提交数据..."; 
}
else if (request.readyState == 1){
  document.getElementById('vts').innerHTML = "正在查找页面,请稍等......"; 
}
else if (request.readyState == 0){
  document.getElementById('vts').innerHTML = "数据未能提交,可能超时造成"; 
}
 

request.send(null); 
}

------解决方案--------------------
request.send(null); 这行没有用
另外仔细检查url 这个数据是否正确
另外,检查错误是客户端的还是服务器端的
------解决方案--------------------
怎么发送了2次??????????????

request.open("POST", "person_upsend.asp", true);
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
request.send(url);  
request.onreadystatechange = function (){
if (request.readyState == 4) {
if (request.status == 200) {


 document.getElementById('vts').innerHTML = "您的信息已经发布到首页";

}

}
 
else if (request.readyState == 3){
document.getElementById('vts').innerHTML = "正在提