Skip to content

Instantly share code, notes, and snippets.

@aratak
Created August 10, 2012 08:13
Show Gist options
  • Save aratak/3312543 to your computer and use it in GitHub Desktop.
Save aratak/3312543 to your computer and use it in GitHub Desktop.
ajax exceptions
$.ajaxSetup
statusCode:
401: -> $.pub('flash:show', text: "You have been logged out. Please, <a href='javascript:window.location.reload()'><span class='icon'>X</span>refresh</a> the page", type: 'warning', hide: false)
404: -> $.pub('flash:show', text: "Page not found", type: 'warning', hide: false)
500: -> $.pub('flash:show', text: "Oops! Something went wrong.", type: 'warning', hide: false)
error: -> $.pub('flash:show', text: "Can't connect to the server. Please, check your internet connection.", type: 'warning', hide: false)
timeout: -> $.pub('flash:show', text: "Server is not response. Please, <a href='http://turbinehq.com/contact/'>report about that to us</a>.", type: 'warning', hide: false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment