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:
function ajaxQuery(params.,..)
new Ajax.Request('your_url', {asynchronous:true, evalScripts:true,
method:'POST', onComplete: function(request){new
Effect.Fade("loader_new",{});}, onLoading:function(request){new
Effect.Appear("loader_new",{});}}); return false;
this is sample, you can easily replace onComplete / onLoading code
with your own js functions, like onComplete: ajaxQuery(params)

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: