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.
I has a similar situation, you'll need to create "manual" js code:
<script>
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;
}
</script>
this is sample, you can easily replace onComplete / onLoading code
with your own js functions, like onComplete: ajaxQuery(params)
...
<%=
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..