Home  >  Article  >  Web Front-end  >  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
coldplay.xixiOriginal
2020-11-25 16:22:082557browse

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" />

to the head in the source html, that is:

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

At the same time, make sure that the target page, such as the Asp.net page, already exists 8b8f47e39e18753aaf82250e55bb0940.

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!

Statement:
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