jquery ajax on fail

JavaScript
fail: function(xhr, textStatus, errorThrown){
	alert('request failed');
}
Source

Also in JavaScript: