Skip to content

Instantly share code, notes, and snippets.

@magnum
Created January 30, 2014 17:07
Show Gist options
  • Save magnum/8713517 to your computer and use it in GitHub Desktop.
Save magnum/8713517 to your computer and use it in GitHub Desktop.
managing rails ajax calls' timeout /error
$.rails.ajax = (options) ->
if not options.timeout
options.timeout = 10000 # 10 secs of timeout
options.error = (jqXHR, textStatus) ->
alert("Si è verificato un errore: \n"+textStatus.toUpperCase())
community_helper.loading_hide()
return $.ajax(options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment