ajax 中文乱码问题 主要是IE浏览器
2015-12-08 13:21
246 查看
解决方案:
提交前采用encodeURI两次编码,注:一定是两次
举例:
var taText = $("#txtName").val();
taText = encodeURI(encodeURI(taText));
$.getJSON("/Index/valid?name=" + taText + "&imageList=" + imageList + "", function (data) {...});
以下解决办法:
在jquery文件中,搜索'contentType'
然后在application/x-www-form-urlencoded后面加上; charset=UTF-8
最终变成contentType:"application/x-www-form-urlencoded; charset=UTF-8"即可。
上面方案实验不可行,不知是否是jquery版本的问题。有用这种方法可行的朋友,欢迎指教。。。
提交前采用encodeURI两次编码,注:一定是两次
举例:
var taText = $("#txtName").val();
taText = encodeURI(encodeURI(taText));
$.getJSON("/Index/valid?name=" + taText + "&imageList=" + imageList + "", function (data) {...});
以下解决办法:
在jquery文件中,搜索'contentType'
然后在application/x-www-form-urlencoded后面加上; charset=UTF-8
最终变成contentType:"application/x-www-form-urlencoded; charset=UTF-8"即可。
上面方案实验不可行,不知是否是jquery版本的问题。有用这种方法可行的朋友,欢迎指教。。。
相关文章推荐
- 用Qemu模拟vexpress-a9 (七) --- 嵌入式设备上安装telnet服务
- Java基础_04_面向对象
- MyEclipse自动跳入debug模式的解决
- SQL重复记录查询
- java对redis的基本操作
- LightOJ 1370 Bi-shoe and Phi-shoe
- CodeForces 7C(扩展欧几里德解方程)
- Spring:入门
- 如何筛选APP推送平台来提升APP运营效果
- 远程连接mysql容易遇到的2个问题
- LightOJ 1370 Bi-shoe and Phi-shoe
- 安卓开发中socket通信开发实例
- 电子书
- C和C++:open("/dev/dcm/0raw",O_WRONLY);
- 使用VC++编译器静态编译Qt5.5
- linux更改文件或目录的属主和属组
- 开始学nodejs —— 调试篇
- @UIColor colorWithPatternImage方法
- hdu2216 Game III 【广搜】
- Linux1.0虚拟文件系统(VFS)