$('#test1').click(function() {
$.ajax({
type:'GET',     
cache:false,     
url:'ajax.php',
data:'name=测试中文',
success:function(msg){
alert(msg);
}
});
});测试上面这段代码,在utf-8编码下的ajax.html页面发送到utf-8编码下的ajax.php页面在ie下面会取不到值,而在firefox下面得到一个正确的值,求解

解决方案 »

  1.   

    js兼容不,有没IE不兼容得js导致错误
      

  2.   

    $('#test1').click(function() {
            $.ajax({
                type:'GET',   
                type:'POST'  
                cache:false,     
                url:'ajax.php',
                data:'name=测试中文',
                success:function(msg){
                    alert(msg);
                }
            });
        })
      

  3.   


    $('#test1').click(function() {
            $.ajax({
                type:'POST',     
                cache:false,     
                url:'ajax.php',
                data:'name=测试中文',
                success:function(msg){
                    alert(msg);
                }
            });
        })
      

  4.   

    楼上,用post当然可以,
    另外。编码之后用get 也可以但是为什么ie在不编码的情况下发送了一个空值给ajax.php??? 这是我想不通的
      

  5.   

    有什么想不通的?
    你用的是AJAX的GET方式;意味着你的data:'name=测试中文'是要以URL参数方式发送到后台;而URL中带中文在编码方面是很容易出错的,所以你编码了就没出错OK了,没编码就出错了呗.
    所以我才建议你用POST