Skip to content

Instantly share code, notes, and snippets.

@dtolj
Created June 27, 2012 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dtolj/3005981 to your computer and use it in GitHub Desktop.
Save dtolj/3005981 to your computer and use it in GitHub Desktop.
auto refresh
#Controller
def action
@tm=Random.rand(11)
render :layout => false
end
#View
#action.haml
=@tm
#index.haml
%div#mydiv
#/app/assets/javascripts/refresh.js
$(document).ready(
function(){
setInterval(function(){
$('#mydiv').load('action');
}, 16100);
});
Output:
action,GET,200,text/html,application.js:18,1.29KB,21ms
action,GET,200,text/html,application.js:18,1.29KB,45ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment