更新时间:2022-06-05 09:10:03
在第一个参数错误处理程序 jqxhr
,它具有这样的性质的responseText
这将给响应主体。
The first param to error handler is jqxhr
, it has the property responseText
which will give the response body.
$.ajax({
type: "POST",
url: '/register',
data : registerRequestJSON,
contentType:"application/json",
success: function(data){
$("#register_area").text();// need to show success
},
error: function(jqxhr) {
$("#register_area").text(jqxhr.responseText); // @text = response error, it is will be errors: 324, 500, 404 or anythings else
}
});