标准jquery ajax ,编码问题
编码问题,主要还是靠Filter来解决。 不过我们可以尝试在jquery ajax里加
contentType: "application/x-www-form-urlencoded; charset=utf-8",
加完后
$("#Load").click(function(){
var postData ='name=Tian Cai';
$.ajax({
url:"https://localhost:9444/HKGCB/content.jsp",
type:"POST",
data:postData,
dataType:"json",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success:function(respon){
$.each(respon.comments, function(index,item){
alert(item.name);
});
},
error:function(er){
alert(er);
}
});
});
只在这里加,不在filter 加是没有用的, 不过filter里加好了,这里就不需要加了。 这个其实是多余的。