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}