Timer for AJAX calls in Rails?

Say I want to perform an ajax action every 10 seconds. Is there a timer function in the built-in JavaScript libraries that will let me do this?

Chris Stewart wrote:

Say I want to perform an ajax action every 10 seconds. Is there a timer function in the built-in JavaScript libraries that will let me do this?

periodically_call_remote ?

How can I prevent the loading of /test/blank in this example?

<%= periodically_call_remote(:url => "/test/blank", :complete =>'addRow("something");return false;', :frequency => 3) %>

All I want to do here is call the javascript function addRow, however I could not figure out how to accomplish this with out leveraging :complete

Any idea? I don't really want to call /test/blank

Thanks in advance

neutek wrote:

How can I prevent the loading of /test/blank in this example?

<%= periodically_call_remote(:url => "/test/blank", :complete =>'addRow("something");return false;', :frequency => 3) %>

All I want to do here is call the javascript function addRow, however I could not figure out how to accomplish this with out leveraging :complete

Any idea? I don't really want to call /test/blank

I suspect if you leave the :url out, and leverage :complete, your browser will periodically call raw JavaScript without hitting a server.

I formerly posted that you could right after I discovered it, but I have since retired that code, so Google for the topic and my street name if you get stuck.