---
title: "标准jquery ajax ,编码问题"
author: "dmwdmc"
date: "2013-05-31T16:34:34Z"
tags: []
categories: ["Web前端"]
slug: "jquery-ajax"
draft: false
lastmod: "2013-05-30T18:32:18Z"
id: 1880222
url: "https://dmwdmc.iteye.com/blog/1880222"
---

编码问题，主要还是靠Filter来解决。
不过我们可以尝试在jquery ajax里加 

> contentType: "application/x-www-form-urlencoded; charset=utf-8", 


加完后

```java
$("#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里加好了，这里就不需要加了。
这个其实是多余的。