I have to modify a project written by someone else. Because the code is a mess I can\'t really change this $.post() (or replace it by $.ajax()). What I need to do, is to know if
Define the error callback immediately after the post. Note the semi-colon placement only at the end.
$.post('balbal.html', json, function(data) {
// ... my code ...
})
.fail(function(response) {
alert('Error: ' + response.responseText);
});
http://api.jquery.com/deferred.fail/
For older versions of jQuery (pre-1.8) Use .error instead with the same syntax.