I'm struggling to find a solution without using jQuery in my current scenario. How can I refresh a partial on my page without reloading the entire page?
Within my new.html.erb file, there's a button that triggers a JavaScript function each time it's clicked. This button also updates a table displaying saved data.
// new.html.erb
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<h1 id="countdown">10</h1>
</div>
<div class="col-md-4"></div>
</div>
// More HTML code
<br>
<div id="plays"><%= render 'table' %></div>
// _table.html.erb
<table class="table">
<thead>
<tr>
<th scope="col">Tick</td>
<th scope="col">Index of image in the array</td>
</tr>
</thead>
<tbody>
<% Play.all.each do |play| %>
<tr>
<td><%= play.current_time %></td>
<td><%= play.image_url %></td>
</tr>
<% end %>
</tbody>
</table>
// savegame.js.erb
JavaScript function contents here
My controller handles the data retrieval and model saving logic for this functionality.
// plays_controller.rb
Ruby code here