jquery ajax提交中文出现乱码?
提交页面为submit.htm代码如下
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>欢迎</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> ... $.ajax({ type:"POST", url: "xx/add_post.php", data:'aa='+escape($('#aa').val())+'&bb='+$('#bb').val(), success: function(html){ alert('添加成功!'); } }); ....
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?php header("Content-Type:text/html;charset=utf-8"); date_default_timezone_set("PRC"); try{ $pdo=new PDO("mysql:host=localhost;dbname=acom", "root", "abcdefghi"); }catch(PDOException $e){ echo $e->getMessage(); } $stmt=$pdo->prepare("insert into acom_a(aa, bb) values(:aa, :bb)"); $stmt->execute(array(":aa"=>$_POST["aa"], ":bb"=>$_POST["bb"])); ?>