为什么xml传递的长度超过2000个字符就不能传递到后台?急。。。。。。
var xmlHttp = null;
if (window.XMLHttpRequest){
// If IE7, Mozilla, Safari, etc: Use native object
xmlHttp = new XMLHttpRequest();
}else {
if (window.ActiveXObject){
// ...otherwise, use the ActiveX control for IE5.x and IE6
xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP ");
}
}
//message = encodeURIComponent(message);
xmlHttp.open( "POST ",
loc + "eMisproIW.dll?operator= "+action+
"&message= "+message+
"&moduleID= "+getCurrentModuleId()+
"&returnType=XML ", false);
xmlHttp.setRequestHeader( "Content-Type ", "text/xml ");
xmlHttp.setRequestHeader( "Content-Type ", "gb2312 ");
window.top.defaultStatus = '数据交互中,请稍候 ';
if(xmlHttp.send()==false){
alert( "数据传输失败! ");
window.top.defaultStatus = '数据交互失败! ';
return false;
}else{
if(isInvalidate(xmlHttp.responseText))
window.close();
window.top.defaultStatus = '数据交互完成! ';
var result = xmlHttp.responseXML;
try{
if(result.childNodes[1].nodeName== 'error '){
window.showAlert(result.childNodes[1].text);
result = null;
}
}catch(e){
}
xmlHttp = null;
return result;
}
------解决方案--------------------大量数据要用POST,
组织好数据(DATA)后用send(DATA)的方式传过去,
要注意字符编码的问题。
------解决方案--------------------xmlHttp.open( "POST ", loc + "eMisproIW.dll? ", false);
xmlHttp.setRequestHeader( "Content-Type ", "application/x-www-form-urlencoded; ");
...
xmlHttp.send(operator= " + action + "&message= " + message + "&moduleID= " + getCurrentModuleId() + "&returnType=XML ");