Skip to content

Instantly share code, notes, and snippets.

@johnkoht
Created April 4, 2014 16:09
Show Gist options
  • Save johnkoht/9977841 to your computer and use it in GitHub Desktop.
Save johnkoht/9977841 to your computer and use it in GitHub Desktop.
$ ->
$('.btn-ajax').on 'click', (e)->
e.preventDefault()
$btn = $(this)
$btn.attr('data-default-text', $btn.html())
if $btn.attr('data-processing-text')
$btn.html($btn.attr('data-processing-text'))
else
$btn.html('processing...')
= link_to "Ajax Button", ajax_path, class: "btn-ajax"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment