easyui form表单.serialize()序列化后中文乱码问题原因及解决
来源:互联网 发布:ncut算法优劣 编辑:程序博客网 时间:2024/06/05 22:53
loginAndRegDialog=$('#loginAndRegDialog').dialog({
closable:false,
modal:true,
buttons:[{
text:"登录",
handler:function(){
var params=$('#LoginInputForm').serialize();
params = decodeURIComponent(params,true);
console.info(params);
$.ajax({
url:'userController.do?login',
data:$('#LoginInputForm').serialize(),
cache:false,
dataType:'json',
success:function(r){
$.messager.alert('My Title',r.msg,'error');
}
});
closable:false,
modal:true,
buttons:[{
text:"登录",
handler:function(){
var params=$('#LoginInputForm').serialize();
params = decodeURIComponent(params,true);
console.info(params);
$.ajax({
url:'userController.do?login',
data:$('#LoginInputForm').serialize(),
cache:false,
dataType:'json',
success:function(r){
$.messager.alert('My Title',r.msg,'error');
}
});
}
就是在调用序列化的时候,中文乱码,
原因:.serialize()自动调用了encodeURIComponent方法将数据编码了
解决方法:调用decodeURIComponent(XXX,true);将数据解码
例如:
var params=$('#LoginInputForm').serialize();
params = decodeURIComponent(params,true);
还有一种办法是直接 --- console.info($('#name').val());
loginAndRegDialog=$('#loginAndRegDialog').dialog({
closable:false,
modal:true,
buttons:[{
text:"登录",
handler:function(){
var params=$('#LoginInputForm').serialize();
params = decodeURIComponent(params,true);
console.info($('#name').val());
$.ajax({
url:'userController.do?login',
data:$('#LoginInputForm').serialize(),
cache:false,
dataType:'json',
success:function(r){
$.messager.alert('My Title',r.msg,'error');
}
});
closable:false,
modal:true,
buttons:[{
text:"登录",
handler:function(){
var params=$('#LoginInputForm').serialize();
params = decodeURIComponent(params,true);
console.info($('#name').val());
$.ajax({
url:'userController.do?login',
data:$('#LoginInputForm').serialize(),
cache:false,
dataType:'json',
success:function(r){
$.messager.alert('My Title',r.msg,'error');
}
});
}
0 0
- easyui form表单.serialize()序列化后中文乱码问题原因及解决
- jquery form表单.serialize()序列化后中文乱码问题原因及解决
- jquery form表单.serialize()序列化后中文乱码问题原因及解决
- jquery form表单.serialize()序列化后中文乱码问题原因及解决decodeURIComponent
- jquery form表单.serialize()序列化后中文乱码问题原因及解决decodeURIComponent
- get方式地址栏传中文参数乱码 及 form表单利用jquery.serialize()序列化中文参数乱码 解决总结
- form表单的序列化及serialize()函数的使用
- jquery之交付序列化表单(serialize)及乱码处理
- jquery之交付序列化表单(serialize)及乱码处理
- 使用Jquery serialize序列化Form表单
- jQuery-serialize()序列化form表单
- JSP+Servlet学习经验1:解决form表单提交后相应页面中文乱码的问题
- jquery序列化serialize()方法时中文乱码及解决办法
- easyui form表单提交中文乱码
- jQuery.form.js进行表单提交,中文乱码问题及解决
- 过滤器解决form表单中中文乱码问题
- Spring MVC 解决form表单提交中文乱码问题
- ajax表单提交使用serialize()方法解决中文乱码
- U-Boot常用命令和常用环境变量
- 希尔排序详解
- startActivityForResult用法
- android ListView异步加载图片,完美实现图文混排
- 串口异步收发的实现
- easyui form表单.serialize()序列化后中文乱码问题原因及解决
- codeforces AIM Tech Round 3 (Div. 2) (A~D)
- 修改tomcat的conf/server.xml解决网页乱码
- Android--加载大分辨率图片到内存
- spring+strust2+mybatis框架下的导出功能的实现
- java反射的基本使用
- 正则表达式介绍
- 欢迎使用CSDN-markdown编辑器
- Aspose.Cells如何设置单元格数字和日期的显示格式