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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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)
...
On Sep 24, 9:26 am, Shishir Srivastava
<shishir.srivast...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i forgot .. offcourse you need link_to_remote with :completed that will call ajaxQuery :) -donations- http://www.yulia-site.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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.. ;)
~Shishir
On Sep 25, 12:02 pm, "alexey.Creopolis"
<alex.creopo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---