The jquery Chinese garbled code is because the contentType does not specify the encoding. The solution: first search for "contentType" in jQuery.js; then add the code after x-www-form-urlencoded as "charset=UTF- 8” is enough.
The operating environment of this tutorial: Windows 7 system, jquery version 1.10.0, Dell G3 computer.
jQuery perfect solution for Chinese garbled characters
Recently encountered the problem of Chinese garbled characters using jQuery. In fact, his Chinese garbled characters are because the contentType does not specify the encoding. , just search for
'contentType'
in jQuery.js and then add
; charset=UTF-8 after application/x-www-form-urlencoded
eventually became
contentType:"application/x-www-form-urlencoded; charset=UTF-8"
The problem is solved, I think the funniest thing is that so many people on the Internet are transcoding again in their own code, and they also wrote Very detailed analysis, how to transfer, so funny.
Recommended: "jquery video tutorial"
The above is the detailed content of Solution to jquery Chinese garbled characters. For more information, please follow other related articles on the PHP Chinese website!