This seems to be what I was loooking for.
Now what I would like to know is how can I restart the call?
Can I push it from the server based on new data now available?

What I am trying to accomplish is to only update a dom when data in the
database has changed.

Thanks

Micah Winkelspecht wrote:
> I took this idea and implemented it in my app.
> 
> In ApplicationHelper, I overrode the periodically_call_remote function 
> with:
> 
>   def periodically_call_remote(options = {})
>     variable = options[:variable] ||= 'poller'
>     frequency = options[:frequency] ||= 10
>     code = "#{variable} = new PeriodicalExecuter(function() 
> {#{remote_function(options)}}, #{frequency})"
>     javascript_tag(code)
>   end
> 
> This will store the PeriodicalExecuter in a variable. In order to set 
> the name of the variable, you can pass in a :variable option. By 
> default, it will use 'poller'.
> 
> So you can do:
> 
> periodically_call_remote(:url => some_url, :update => 'some_div', 
> :variable => 'my_var')
> 
> And when you want to stop the polling, you can inject the following line 
> of javascript into your page:
> 
> <script>
>   my_var.stop();
> </script>
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to