I am apologize for the stupid question, but I need your help. I need to get information about response inside AJAX
.
$.ajax({
type: "POST",
url: '/register',
data : registerRequestJSON,
contentType:"application/json",
success: function(data){
$("#register_area").text();// need to show success
},
error: function(err) {
$("#register_area").text("@text"); // @text = response error, it is will be errors: 324, 500, 404 or anythings else
}
});
How can I use response body? (documentation Jquary.Ajax is not working at the momment)
The first param to error handler is
jqxhr
, it has the propertyresponseText
which will give the response body.