【jquer】用jquer中的serialize()方法获取form表单中的值的时候,中文乱码

参考链接:https://www.cnblogs.com/huangshuqiang/p/5710230.html

乱码原因:serialize()自动调用了encodeURIComponent方法将数据编码了 。
解决方法:调用decodeURIComponent(XXX,true);将数据解码 。

例如:

var params = jQuery("#formId").serialize(); // http request parameters.   
5 params = decodeURIComponent(params,true); 

猜你喜欢

转载自blog.csdn.net/Black_Customer/article/details/107517646