always ajax code example Example: jquery ajax on fail Click to copyfail: function(xhr, textStatus, errorThrown){ alert('request failed'); }