Forum: Ruby on Rails Problem with 'periodically_call_remote'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
783fed8af50259766b40d2f550ec5974?d=identicon&s=25 Alex (Guest)
on 2006-06-10 12:26
My ajax-application have folowing behaviour: Just 1 page loaded
with 1st request and all other content always loaded into special DIV
using ajax when user clicked menuitems.

On some "pages" I using 'periodically_call_remote', but I can't STOP
it!

Simple example:

View:

<div id="view">
  <%= link_to_remote 'Stop tracking', :url => { :action => 'stop' } %>
  <%= periodically_call_remote :url => { :action =>
'track_all' }, :update => 'tracking' %>
  <div id="tracking"></div>
</div>

Controller:

def track_something
  # DATABASE ACCESS HERE
  ....
  render :partial => 'track'
end

def stop
  render :update do |page|
    page.remove 'view'
  end
end

When 'stop' action executed, database access still work... It's strange
isn't it?

PS: It's stoped after refreshing the page, but my application renders
all content using ajax requests and I can't refresh - displayed data
will be lost.
This topic is locked and can not be replied to.