Using Returned Value In JavaScript To Change Database Value in Ruby on Rails

I’m currently trying to take a object that is created in ruby and change the its value of :correct = 1 to :correct = 0 based on evaluation done through JavaScript.

I have a script that is tied to a ruby submit button (below), and that script then returns a 1 or a 0 depending on other items on the page.

<%= submit_tag "Submit",:class => "btn btn-primary", :id => "submit-question-set-#{@question_set.id}",
                                     :onclick => "return ReadTableAnswers();" %>

Currently once the object is submitted the default value is 1, is there any way to tie the returned value to the submit_tag or is there another method that would allow this to work?

Thank you