Solution to getjson garbled code in jquery: 1. Use Notepad to save the file as [utf-8]; 2. Use VS to save the file as [utf-8] encoding.
The operating environment of this tutorial: windows7 system, jquery3.2.1 version, DELL G3 computer. This method is suitable for all brands of computers.
Recommended: jquery video tutorial
Solution to getjson garbled code in jquery:
Today, use jQuery’s getJSON to get data , the result is garbled. There is no problem with my webpage encoding, but my data is in the JSON string of a static file, so I suspect it is a file encoding problem. Open it with Notepad, and it is indeed ANSI encoded.
Solution:
1. Use Notepad to save the file as utf-8.
2. Use VS to save the file and change it to utf-8 encoding. The location is in the small triangle to the right of the Save button in the Save As dialog box.
3. If VS2005sp1 is installed, there will be an additional item in the file menu: Advanced Save Options. It is said that after selecting the encoding, all files in the project will be saved according to this encoding.
Related free learning recommendations: javascript (video)
The above is the detailed content of What to do if getjson is garbled in jquery. For more information, please follow other related articles on the PHP Chinese website!