function doUpdate(){
try {
var sel = getRightSel();
var modeno = document.form1.modeno.value;
var url = "UpdateDo.do?sel="+sel+"&modeno="+modeno;
String.prototype.trim = function(){return this.replace(/\s/g,'');}
var url1 = encodeURI(url.trim());
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open("POST",url1,false);
xmlHttp.send();
var result= xmlHttp.responseText;
var resulet1 = result.trim();
if (resulet1=='false'){
return false;
}else{
alert("修改成功");
}
}catch(exception) {
alert('<bean:message key="centerResume.serverShutDown"/>');
}
return false;
}
使用 encodeURI 编码,使URL采用utf-8编码提交,否则中文将被改成其它编码格式。
本文介绍了一个JavaScript函数doUpdate,用于通过POST请求更新数据,并确保URL采用UTF-8编码提交,避免中文字符被错误编码。
460

被折叠的 条评论
为什么被折叠?



