javascript - How to auto-refresh a div -
i have controller , view div :
def show @requests = events.get_requests end
get_requests
returns requests in database select, output in div in view:
<div class="party-block" id="requests"> <h4><%= t '.requests' %></h4> <input type="button" value="<%= t '.refresh' %>" onclick="window.location.reload()" class="btn-sm btn-info"> <% @requests.each |r| %> <span class="request"> ...
in div print requests other things.
i want automatically refresh div javascript/jquery function. moment use button refresh need re-execute code in controller?
there function in javascript named setinterval
lets schedule function executed every time interval.
http://www.w3schools.com/js/js_timing.asp
setinterval(function() { console.log("hi there"); }, 1000);
Comments
Post a Comment