Open aleemb opened 8 years ago
I had the same issue and ended up doing something like this:
$(document).on('pjax:error', function (event, xhr, textStatus, errorThrown, options) {
event.preventDefault();
options.success(xhr.responseText, textStatus, xhr);
$('html').html(xhr.responseText);
});
this will affect all 4xx/5xx not just on post.
As per documentation,
However, for forms via
$.pjax.submit
this doesn't hold true and causes silent failures without any indication to the user. Would be good if the same could hold true for POST request to forms that result in a 5xx error so PJAX would just show the resulting error page instead of discarding the server response.