Skip to content

Instantly share code, notes, and snippets.

@DivineDominion
Last active December 15, 2015 13:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?

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