Auto refresh of page in Rails 3 using javascript

Posted by teknull on Stack Overflow See other posts from Stack Overflow or by teknull
Published on 2013-03-20T14:51:32Z Indexed on 2013/11/11 9:55 UTC
Read the original article Hit count: 108

Filed under:

I have a view in my rails app: blah.app/units/status

This displays a status of all my units. I'd like to have the page automatically refresh via javascript but I'm not sure how to do it.

I tried writing this but it doesn't reload:

<script>
  $(function() {
    setInterval(function(){
      $.getScript("/units/status");
    }, 10000);
  });
</script>

Can someone point out where I'm going wrong here?

© Stack Overflow or respective owner

Related posts about JavaScript