Hi, Can anybody pls help me? I have this code: new Ajax.Request(''something.html'' , { method: ''get'', parameters: {ID: ''1'', ID2: ''2''}, onLoading: function(){ alert(''loading!'');}, onComplete: function(){ alert(''Complete!'');} }); } and in Safari, the "complete" alert pops up first, and then the "loading" alert pops up. In Firefox it seemingly random; sometimes complete is first, sometimes loaded is first. Can''t try it in IE now because i''m on a mac. Does anyone have any clue as to why this is happening? It doesn''t matter what page i call (something.html, that doesn''t exist, or some page that does) all i wanted to do is show a loading image while the page loads, and hide it on complete/success... *help* :( Cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey there, The Loading/Loaded/Interactive stages are implementation-dependent and therefore not guaranteed, as clearly stated in the docs. But your need is very common, and so is its solution: use Ajax.Responders instead and the onCreate/onComplete callbacks. Something like: Ajax.Responders.register({ onCreate: function() { $(''indicator'').show(); }, onComplete: function() { if (0 == Ajax.activeRequestCount) $(''indicator'').hide(); } }); ''HTH -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.prototypejs.org/api/ajax/options and http://www.prototypejs.org/api/ajax/request says that onLoading is not guaranteed. By this, I would take it to mean that either the call won''t be made internally or when it happens won''t necessarily follow any particular pattern 100% of the time. Richard. On 09/05/07, CoolJazz <erikjanlam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > Can anybody pls help me? > I have this code: > > new Ajax.Request(''something.html'' , { > method: ''get'', > parameters: {ID: ''1'', ID2: ''2''}, > onLoading: function(){ > alert(''loading!'');}, > onComplete: function(){ > alert(''Complete!'');} > }); > } > > and in Safari, the "complete" alert pops up first, and then the > "loading" alert pops up. > In Firefox it seemingly random; sometimes complete is first, sometimes > loaded is first. > Can''t try it in IE now because i''m on a mac. > > Does anyone have any clue as to why this is happening? > It doesn''t matter what page i call (something.html, that doesn''t > exist, or some page that does) > > all i wanted to do is show a loading image while the page loads, and > hide it on complete/success... *help* :( > > Cheers > > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, thanks alot, that did the trick. Cheers mate On May 9, 12:28 pm, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> Hey there, > > The Loading/Loaded/Interactive stages are implementation-dependent and > therefore not guaranteed, as clearly stated in the docs. > > But your need is very common, and so is its solution: use > Ajax.Responders instead and the onCreate/onComplete callbacks. > Something like: > > Ajax.Responders.register({ > onCreate: function() { $(''indicator'').show(); }, > onComplete: function() { > if (0 == Ajax.activeRequestCount) > $(''indicator'').hide(); > } > > }); > > ''HTH > > -- > Christophe Porteneuve aka TDD > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---