periodically_call_remote passes the supplied options hash (minus the
:frequency option) to the remote_function method, which accepts the same
parameters as link_to_remote. so check the docs for link_to_remote for
acceptable parameters and usage. from the docs, :conditions =>
"javascript
code" would be what you want.
an example that i would imagine would work (untested):
<%= periodically call remote( :url => { :controller =>
"mycontroller",
:action => "myaction", :id => "123" }, :frequency
=> 10, :condition => "
Element.visible(''results'') == true ", :update =>
"results") -%>
this says to call the remote url of /mycontroller/myaction/123 every 10
seconds and update the DOM element with id = ''results'' ONLY IF
the element
is visible
btw, session information is handled transparently by the ajax calls, so you
don''t have to track sessions by passing information in the url.
On 6/15/06, Guest <sombreroisland@gmail.com>
wrote:>
> Hi guys,
>
> I''ve been reading through the forums and came across a response
for
> adding :with condition to a periodically call remote.
>
> I tried it out and couldn''t make it work. Would anyone have a
sample of
> how to use this conditional structure with periodically call remote?
>
> If not, does anyone have any idea how to add a condition to a
> periodically call remote?
>
> What I need is to pass the values of my userid together with the
> periodically call remote function so that my index controller knows that
> this particular session is the one that is requesting this update from
> the server.
>
> thanks,
>
> Bing
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060615/100614dc/attachment.html