Create a gist now

Instantly share code, notes, and snippets.

Where, instead of my inefficient approach, I execute XHR JavaScript responses. Behaves just like JangoSteve said it should for 400 or 424 HTTP response status codes.

Binds the event on $(document) so that dynamically created forms will be affected, too.

$(document).ready(function() {
$(document).on('ajax:error', 'form[data-remote="true"]', function(evt, xhr, status) {
eval(xhr.responseText);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment