I want to display a message from a list of messages and have it change to the next message every 10 seconds.
I have achieved this by putting the following javascript into my rhtml file...
<div id='dynamic_message'></div> <script type="text/javascript"> var messages=["Message One", "Message Two", "Message Three"] var message=0; new PeriodicalExecuter(function() {$("dynamic_message").innerHTML = messages[message++%messages.length];}, 10); </script>
Is there a railsy way of achieving the same thing?
The only thing I could find was periodically_call_remote which I didn't want to use because it would need to contact the server for every update which isn't efficient.