Check the server response using status code.

$.ajax({
statusCode: {
400: function() {
alert('400 status code! user error');
},
500: function() {
alert('500 status code! server error');
}
200: function() {
alert('200 status code! Success');
}
}
});