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.
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 <%@ 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!