Problem Description: jquery's character set is Utf-8,load method after loading GB2312 code static page, the occurrence of Chinese garbled.
a.php
Copy Code code as follows:
<script language= "javascript" type= "Text/javascript" >
$ (function () {
$ ("#zz"). Click (function () {
$ ("#job"). Load ("b.php");
})
})
</script>
<a id= "ZZ" > Click Load B page </a>
<div id= "Job" ></div>
b.php
Copy Code code as follows:
<?php
echo "I have Chinese in it";
?>
Solution:
Method One: Converts the encoding format of two pages into UTF8
Method Two: Add a line to the beginning of the b.php: header ("content-type:text/html; charset=gb2312 ");
A.php to (not change should also line):
Copy Code code as follows:
$ ("#job"). Load (' b.php ', function (Rtext) {
$ ("#job"). HTML (rtext);
});
Solve the problem.
If you are using the Smarty template engine, a.php is loading the template b.html, make the PHP tag available first, and then add in b.html: {Php}header ("content-type:text/html; charset=gb2312 "); {/php}