Skip to content

Instantly share code, notes, and snippets.

@johnnypez
Last active December 17, 2015 08:49
Show Gist options
  • Save johnnypez/5583133 to your computer and use it in GitHub Desktop.
Save johnnypez/5583133 to your computer and use it in GitHub Desktop.
jquery-rails ajax events

# rails:attachBindings

fired when jquery-rails starts attaching bindings to links, forms etc.

# confirm

gives you the opprotunity to skip a confirm dialog by returning a falsy value

# confirm:complete

triggered when the confirm dialog has been answered

is passed the answer

has the opportunity to stop the request by returning a falsy value

# ajax:before

jquery-rails triggers this before the request is sent

cancels the request if it returns a falsy value

# ajax:beforeSend

standard ajax callback fired during request cycle

stopping the "ajax:beforeSend" event will cancel the ajax request

# ajax:send

standard ajax callback fired during request cycle

# ajax:success

standard ajax callback fired during request cycle

# ajax:complete

standard ajax callback fired during request cycle

# ajax:error

standard ajax callback fired during request cycle

# ajax:aborted:required

fired if a form has blank required inputs

i.e. inputs that match $("input[name][required]")

# ajax:aborted:file

fired if a form has blank required file inputs

# ujs:everythingStopped

seems to be used internally when stopEverything is called, don't know if it's much use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment