ITeye博客

标准jquery ajax ,编码问题

dmwdmc · 2013-05-31 16:34 · javascript ajax jquery · Web前端 · Markdown

编码问题,主要还是靠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里加好了,这里就不需要加了。 这个其实是多余的。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。