Created
April 11, 2013 09:54
-
-
Save reyesyang/5362129 to your computer and use it in GitHub Desktop.
Ajax exception handler for rails-ujs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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