Recursive ajax call

Hi,
Is there any rails ajax tag or possibly any option with the existing
ones , to set the recursive ajax calls.

For e.g. If I wish to automatically send the next ajax request only
when the response from the first one is received.

I can do this by setting the call to the same function in
the :complete=>‘recursive_func’, however the ajax tags such as
periodically_call_remote or link_to_remote etc don’t let us specify
any name for the corresponding javascript function.

Any ideas, suggestion on how to implement this.

TIA
~Shishir

I has a similar situation, you’ll need to create “manual” js code:

this is sample, you can easily replace onComplete / onLoading code
with your own js functions, like onComplete: ajaxQuery(params)

On Sep 24, 9:26 am, Shishir Srivastava [email protected]

Yes i forgot .,.

first make regular ajax “button” …
that will launch “recursive” function i described above.
<%= link_to_remote … :complete => “ajaxQuery();” … %>

-donation to Yulia-
http://www.yulia-site.org

i forgot …

offcourse you need link_to_remote with :completed that will call
ajaxQuery :slight_smile:

-donations-
http://www.yulia-site.org

Thanks Alexey. However, I did this using a combination of some of the
options which periodically_Call_remote provides. I implemented it like
this

<%= periodically_call_remote :update => ‘’,
:condition => "document.getElementById("hidden
“).innerHTML==‘false’”,
:url => {:action => “msg_handler”},
:frequency => 2.0,
:after => “hold(true)”,
:complete =>“hold(false)” %>

<%=
function hold(value) {
document.getElementById(“hidden”).innerHTML=value
}"

)
%>

Basically I am toggling between the values of an element ‘hidden’ to
automatically send ajax request only when the response has been
received from the first one. And it works… :wink:

~Shishir

On Sep 25, 12:02 pm, “alexey.Creopolis” [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs