您的位置:首页 > Web前端 > JQuery

Spring mvc @ResponseBody jquery ajax调用出现如下错误:406 Not Acceptable

2012-07-04 02:11 344 查看
jQuery.ajax({
type: "POST",
url: "ajax/ajaxCheckLoginName.do",
data: "username="+$("#name").val(),
error: function(XMLHttpRequest, error, errorThrown){
alert(error);
alert(errorThrown);
},
success: function(response){
if(response==1){ $("#name").removeClass("extra");}
}
});


controller执行正常,jquery.ajax始终无法执行回调函数

加入错误查看代码:

error: function(XMLHttpRequest, error, errorThrown){
alert(error);
alert(errorThrown);
},


提示: Not Acceptable

The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().

需要加入jackson依赖:

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.5</version>
</dependency>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐