Home > Web Front-end > JS Tutorial > What to do if getjson is garbled in jquery

What to do if getjson is garbled in jquery

coldplay.xixi
Release: 2023-01-04 09:36:35
Original
3273 people have browsed it

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.

What to do if getjson is garbled in jquery

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template