Home > Web Front-end > JS Tutorial > What should I do if the Chinese garbled characters appear when the jQuery load method loads a document?

What should I do if the Chinese garbled characters appear when the jQuery load method loads a document?

coldplay.xixi
Release: 2020-11-30 14:29:15
Original
2589 people have browsed it

Solutions to Chinese garbled characters when loading documents using the jQuery load method: 1. The loaded document itself should be encoded in [UTF-8] format; 2. Just add the relevant code to the head in the source html.

What should I do if the Chinese garbled characters appear when the jQuery load method loads a document?

The operating environment of this tutorial: Windows 7 system, jquery version 3.2.1. This method is suitable for all brands of computers.

Solution to Chinese garbled characters when the jQuery load method loads documents:

Method 1: The loaded document itself should be encoded in UTF-8 format.

In Notepad, the default encoding is ANSI encoding, and the encoding format can be changed by saving as.

In DW, by setting the preferred parameters, you can set the new document to use UTF-8 encoding, and the document itself will also change to UTF-8 encoding.

Method 2: Add

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
Copy after login

to the head in the source html, that is:

   
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
Copy after login

At the same time, make sure that the target page, such as the Asp.net page, already exists <%@ Page ResponseEncoding="gb2312" ....%>.

Related free learning recommendations: javascript (video)

The above is the detailed content of What should I do if the Chinese garbled characters appear when the jQuery load method loads a document?. 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