ajax获取数据中文乱码问题最简单的完美解决方案

使用scriptCharset即可解决问题,用contentType就不一定可以了。

$.ajax({  
                type: "get",  
                async: false,  
                url: requesturl,  
                data:{},
                dataType: "jsonp",  
                jsonp: "callback",  
                jsonpCallback:"JsonCallback",
                scriptCharset: 'utf-8',
                success: function (json) {  
                    console.log(json);  
                },  
                error: function (e) {  
                    console.log(e);  
                }  
            });
 

上面的解决方案是最完美的,另外也附上网上的解决方式吧,是用contentType来处理的

jQuery(form).ajaxSubmit({ 
url: "ajax.aspx?a=memberlogin", 
type: "post", 
dataType: "json", 
contentType: "application/x-www-form-urlencoded; charset=utf-8", 
success: showLoginResponse 
});