解决Ajax向jsp传参中文乱码的问题
2012-03-05 16:54
351 查看
通过找资料,确实解决了,但是知其然,还不知其所以然.....
try {
$.ajax({
url : "getdevicelist.jsp",
type : "post",
data : "DeviceType=" + encodeURI(encodeURI(iValue)) + "&InstallLocation=" +encodeURI(encodeURI(m_szDeviceInstallLocation)),
dataType : "html",
error : function() {
alert("Error");
},
success : function(msg) {
$("#DeviceName").empty();
msg = $.trim(msg);
if (msg != "") {
$(msg).appendTo("#DeviceName"); // 添加下拉框的option
if(document.getElementById("DeviceName").options.length > 0)
{
setTimeout(function() { $("#DeviceName option[value='"+ m_szDeviceName+"']").attr("selected",true);}, 1);
}
}
},
complete : function() {
// CompleteLogUser();
}
});
} catch (err) {
// alert(err.description);
}
szInstallLocation = request.getParameter("InstallLocation");
String ttt = java.net.URLDecoder.decode(szInstallLocation,"UTF-8"); ///Over
szInstallLocation = szInstallLocation.trim();
try {
$.ajax({
url : "getdevicelist.jsp",
type : "post",
data : "DeviceType=" + encodeURI(encodeURI(iValue)) + "&InstallLocation=" +encodeURI(encodeURI(m_szDeviceInstallLocation)),
dataType : "html",
error : function() {
alert("Error");
},
success : function(msg) {
$("#DeviceName").empty();
msg = $.trim(msg);
if (msg != "") {
$(msg).appendTo("#DeviceName"); // 添加下拉框的option
if(document.getElementById("DeviceName").options.length > 0)
{
setTimeout(function() { $("#DeviceName option[value='"+ m_szDeviceName+"']").attr("selected",true);}, 1);
}
}
},
complete : function() {
// CompleteLogUser();
}
});
} catch (err) {
// alert(err.description);
}
szInstallLocation = request.getParameter("InstallLocation");
String ttt = java.net.URLDecoder.decode(szInstallLocation,"UTF-8"); ///Over
szInstallLocation = szInstallLocation.trim();
相关文章推荐
- 解决Ajax向jsp传参中文乱码的问题
- jsp中 ajax的get请求的中文乱码问题的解决方法
- jsp中 ajax的get请求的中文乱码问题的解决方法
- Ajax + jsp +servlet 中文乱码问题解决办法
- jsp传参 servlet接收中文乱码问题的解决方法
- jsp 的url传参中文乱码问题解决办法
- JSP中,AJAX使用POST方式提交中文乱码问题解决
- 解决jsp页面之间,jsp和后台之间传参中文乱码问题
- JSP、AJax中文乱码问题解决,escape(), encodeURI(), encodeURIComponent(),js对参数连续两次调用 encodeURI(String) 方法
- jsp中使用传参时出现中文乱码问题的解决方法
- JSP解决ajax使用$.get()方式提交中文出现乱码问题
- jsp get传参中文乱码问题解决方法
- 解决jsp中获取url传参中文乱码问题
- JSP中,AJAX使用POST方式提交中文乱码问题解决
- 【WEB】jsp向servlet传参中文乱码问题解决
- JSP、AJax中文乱码问题解决,escape(), encodeURI(), encodeURIComponent(),js对参数连续两次调用 encodeURI(String) 方法
- jquery+jsp+servlet做$.ajax交互时出现中文乱码(字符集问题)的解决方案
- JSP中文乱码问题的解决
- Ajax解决中文乱码问题