I'm using Rails 3.1 and I need a checkbox to toggle and save to the database without the page refreshing or redirecting.
Let me preface by saying i'm fairly novice, if i'm coming at this problem from the wrong angle please let me know.
Here is my form:
<% form_for book, :remote => true do |f| %>
<%= f.check_box :finished %>
<% end %>
Here is my jQuery javascript:
$('input#book_finished').live("click", function() {
$(this).parent('form').submit();
});
The :remote = > true doesn't work when I submit via jQuery, but does if I throw in a submit button (which I can't have). How can I submit on clicking the checkbox though JS?