Skip to content

Instantly share code, notes, and snippets.

@reyesyang
Created April 11, 2013 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reyesyang/5362129 to your computer and use it in GitHub Desktop.
Save reyesyang/5362129 to your computer and use it in GitHub Desktop.
Ajax exception handler for rails-ujs
on('ajax:error', function(e, xhr, status, errors){
var error;
try {
error = $.parseJSON(xhr.responseText);
} catch(e) {
error = {message: '服务器忙,请稍后再试!'};
}
//code to show error message
//$(this).find('.modal-errors').text(error.message);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment