Skip to content

Instantly share code, notes, and snippets.

@dtolj
Created June 27, 2012 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtolj/3004058 to your computer and use it in GitHub Desktop.
Save dtolj/3004058 to your computer and use it in GitHub Desktop.
periodically_call_remote jQuery
#assets/javascripts/refresh.js
$(document).ready(
function(){
setInterval(function(){
$('#mydiv').load('action');
}, 16000);
});
#CONTROLLER
def action
@tm=Random.rand(11)
end
#VIEWS
#action.haml
=@tm
#index.haml
%div.mydiv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment