Problem description: The character set of jquery is utf-8. After the load method loads the GB2312 encoded static page, Chinese garbled characters appear.
a.php
b.php
echo "I have Chinese here";
?>
Solution: Method 1: Convert the encoding format of the two pages to utf8
Method 2: Add a line at the beginning of b.php: header("Content-type : text/html; charset=gb2312");
a.php is changed to (it should be fine without changing it):
$("#job").load('b.php',function(rText){
$("#job"). html(rText);
});
Problem solved.
If you are using the smarty template engine and a.php loads the template b.html, you must first make the php tag available, and then add: {php}header("Content-type : text/html; charset=gb2312");{/php}
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