I\'m trying to get a selection from a dropdown to populate a table in the same page, using AJAX so that changes appear without a page refresh. I\'ve got as far as working ou
In js(RJS) file you need to call partial HTML file and this file have tables That you shown here in your question.
I hope this helps you.
Thanks.
Create one partial _project.html.erb
and render this partial in index page.
<%= render @projects %>
On change of project just render partial with project object and update page using rjs.
Assume you're using jquery
<%= collection_select :project, :id, Project.all, :id, :name, {}, {:onchange => '$.get("/populate_projects")'} %>
then in your controller
def populate_projects
@project = Project.find(params[:id])
respond_to do |format|
...
format.js { render 'populate_projects', :formats => [:js] }
...
end
end
finally, create populate_projects.js.erb
and write any change table content script. @project
is available in that script.