Skip to content

Instantly share code, notes, and snippets.

@Hampei
Created May 31, 2012 12:25
Show Gist options
  • Save Hampei/2843052 to your computer and use it in GitHub Desktop.
Save Hampei/2843052 to your computer and use it in GitHub Desktop.
rails jquery coffeescript to throw remote-form reponse into a given element.
# response-html of forms replace the innerHTML of given element.
# usage <form data-remote='true' data-replace-element='#replace_my_contents'>...
$(document).on("ajax:success", "form[data-replace-element]", (el, data, status, xhr) ->
$($(this).data('replace-element')).html(data);
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment