I have a Rails 3.2.16 app where I'd like to display the current time such as Time.zone.now.strftime("%H:%M:%S")
in the application.html.erb
layout file in my menu header. I'd like it to display and refresh refresh every second so it keeps proper time (or as close to realtime as possible minus app latency).
What would be the best way to include this in my application.html.erb
in the navbar and get it to display the time and refresh every second?
Maybe there's a Javascript or jQuery function I can use to do this or maybe some Ajax? I can get the time to display fine, but I need to figure out how to refresh it without a page reload.
Any help would be appreciated.