用jQuery的$.getJSON方法提交中文参数时,会出现乱码问题,解决方法有两种:
1、对提交的中文参数进行处理,encodeURI(),PHP在后台接收参数时进行urldecode()。
2、不用getJSON方法,改用$.POST
$.post(url, data, function(){
//code
}, "json");
用jQuery的$.getJSON方法提交中文参数时,会出现乱码问题,解决方法有两种:
1、对提交的中文参数进行处理,encodeURI(),PHP在后台接收参数时进行urldecode()。
2、不用getJSON方法,改用$.POST
$.post(url, data, function(){
//code
}, "json");
转载于:https://my.oschina.net/u/1161990/blog/815634