Skip to content

Instantly share code, notes, and snippets.

@mrdanadams
mrdanadams / application.js
Created Mar 28, 2012
Updating a DIV with partials after remote AJAX form submit in Rails 3
View application.js
$(function() {
/* Convenience for forms or links that return HTML from a remote ajax call.
The returned markup will be inserted into the element id specified.
*/
$('form[data-update-target]').live('ajax:success', function(evt, data) {
var target = $(this).data('update-target');
$('#' + target).html(data);
});
});