$.ajax(settings).done(function (response) error code example
Example: jquery ajax on fail
fail: function(xhr, textStatus, errorThrown){
alert('request failed');
}
fail: function(xhr, textStatus, errorThrown){
alert('request failed');
}