Recursive ajax call

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.


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-

i forgot …

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


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

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

function hold(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:


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