Hello all!
I am new to Ruby on Rails and AJAX and I am curious as to the best way to achieve the following:
I have an index.html.erb file that lists some records.
In this page I have some checkbox buttons. When these buttons are checked or unchecked, a javascript array is updated.
When my checkboxes are toggled a ) javascript function is called that does the following ruby code to update the elements on the page (hides and shows elements without refreshing the page or using a controller
Code:
<% Post.recent(**selected = []**).each do |post| %>
... retrieve data from database and hide/show elements
<% end %>
I understand that since javascript runs on the client and ruby on the server, I can't pass a js variable to ruby but how can I achieve the intended result?
Thank you.
Bookmarks