js代码
$.ajax({
url:"/pblog/article/add",
type:"POST",
contentType:"application/json",
dataType:"json",
data: JSON.stringify(articleVO),
success:function (result) {
// if(result.success()){
// alert(1);
// }
}
})
java代码
@RequestMapping(value="add", method = RequestMethod.POST)
@ResponseBody
public Result addArticle(@RequestBody ArticleVO articleVO){
Result result = new Result();
return result;
}
请求的时候报:415 (Unsupported Media Type)
解决办法 pom.xml加入下面jar
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.4</version>
</dependency>