I have a Rails view with 3 partials. In my index.html.erb I have the following javascript to refresh the page automatically via JS.
index.html.erb
<div id="newstatus">
<%= render 'newstatus' %>
</div>
<div id="newunitdisplay">
<%= render 'newunitdisplay' %>
</div>
<div id="unitalerts">
<%= render 'unitalerts' %>
</div>
<script>
$(function() {
setInterval(function(){
$.getScript("/mdt");
}, 10000);
});
</script>
index.js.erb
$("#newunitdisplay").html("<%= escape_javascript render("newunitdisplay") %>");
$("#newstatus").html("<%= escape_javascript render("newstatus") %>");
$("#unitalerts").html("<%= escape_javascript render("unitalerts") %>");
What I would like to do is to only refresh 2 of the 3 partials. newunitdisplay and newstatus. I have some audio_tag statements in unitalerts that I don't want to refresh otherwise the sounds will continuously look every 10 seconds.
My question is what would the javascript look like to refresh just the two partials for newunitdisplay and newstatus?
It's the only way I can think of that will keep the audio_tags I have from looping every 10 seconds.
Thanks in advance.