Last active
December 16, 2015 14:49
-
-
Save originalpete/5451373 to your computer and use it in GitHub Desktop.
Railsgirls javascript submit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
$('.update-done :checkbox').on('change', function () { | |
var checkbox = $(this); | |
var form = checkbox.parent('form'); | |
$.ajax(form.attr('action'), {type: 'PUT', data: form.serialize()}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td class="update-done"> | |
<%= form_for idea , :url => update_done_idea_path(idea), :method=>"put" do |f| %> | |
<%= f.check_box :done %> | |
<% end %> | |
</td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :ideas do | |
put :update_done, :on => :member | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment