js是这样写的:
var url = 'http://localhost/index.php?title="这里是中文参数"';
$.getJSON(url,function(data){
alert(data.title);
});
这个是index.php接收json的
$arr = array('title'=>$_GET['title']);
$jsonencode = json_encode($arr);
echo $jsonencode;
现在不能获取到title里面的中文,是中文的话 就输出的 null。 如果换成英文就行.JSONJavaScript

解决方案 »

  1.   

    用escape("中文") 编码后传输
      

  2.   

    编码的问题吧,两个文件都设置为utf-8编码后再试。
      

  3.   


    var url = 'http://localhost/index.php';
    $.getJSON(url,{title:"中文么?"},function(data){
    alert(data.title);
    });$.getJSON(url,data,callback);jQuery会把要发送的数据用$.param进行url encode。如果要自己写,用encodeURIComponent编码。在php端只要编码方式一致,直接获取就可以,不需要解码。