Dirk Eschler
2005-Dec-29 12:00 UTC
Ajax.Request: onLoading executed after onComplete in IE
Hi, i''m trying to use a visual indicator for my Ajax requests. It''s based on the shopping cart demo at script.aculo.us and works great in Firefox, Konqueror and Opera, but fails in IE6. For some reason (timing problems?) onComplete is executed before onLoading, so the indicator is shown but not hidden when the request has finished. Oddly enough it works fine in the shopping card demo. It happens with both, script.aculo.us 1.5.0 and 1.5.1. Here''s the (somewhat reduced) code i''m using: ---------------------------------------- new Ajax.Request(''/cgi-bin/foo.pl'', { parameters: ''x=y'', onSuccess: handlerFunc, onFailure: errFunc, onLoading: function() { alert(''onLoading''); Element.show(''indicatorContainer''); }, onComplete: function() { alert(''onComplete''); Element.hide(''indicatorContainer''); } }); ---------------------------------------- Any help is appreciated. -- Dirk Eschler zeitform Internet Dienste mailto:eschler-zc1r9W/44D4b1SvskN2V4Q@public.gmane.org Fraunhoferstraße 5 PGP S/MIME: http://key.zeitform.de/ap 64283 Darmstadt, Germany Tel./Fax: +49 (0) http://www.zeitform.de
Hi, You should better use Responders.register, for example : Ajax.Responders.register({ onCreate: function() { if(Ajax.activeRequestCount>0) { Position.prepare(); var elt = $(''ajax-wait''); elt.style.left = Position.deltaX + "px"; elt.style.top = Position.deltaY + "px"; Effect.Appear(''ajax-wait'',{duration:0.5}); } }, onComplete: function() { if(Ajax.activeRequestCount==0) { Effect.Fade(''ajax-wait'',{duration:0.5}); } } }); Regards, Nico On 12/29/05, Dirk Eschler <eschler-zc1r9W/44D4b1SvskN2V4Q@public.gmane.org> wrote:> > Hi, > > i''m trying to use a visual indicator for my Ajax requests. It''s based on > the > shopping cart demo at script.aculo.us and works great in Firefox, > Konqueror > and Opera, but fails in IE6. For some reason (timing problems?) onComplete > is > executed before onLoading, so the indicator is shown but not hidden when > the > request has finished. > > Oddly enough it works fine in the shopping card demo. It happens with > both, > script.aculo.us 1.5.0 and 1.5.1. Here''s the (somewhat reduced) code i''m > using: > > ---------------------------------------- > new Ajax.Request(''/cgi-bin/foo.pl'', { > parameters: ''x=y'', > onSuccess: handlerFunc, > onFailure: errFunc, > onLoading: function() { > alert(''onLoading''); > Element.show(''indicatorContainer''); > }, > onComplete: function() { > alert(''onComplete''); > Element.hide(''indicatorContainer''); > } > }); > ---------------------------------------- > > Any help is appreciated. > > -- > Dirk Eschler zeitform Internet Dienste > mailto:eschler-zc1r9W/44D4b1SvskN2V4Q@public.gmane.org Fraunhoferstraße 5 > PGP S/MIME: http://key.zeitform.de/ap 64283 Darmstadt, Germany > Tel./Fax: +49 (0) http://www.zeitform.de > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Dirk Eschler
2005-Dec-30 14:59 UTC
Re: Ajax.Request: onLoading executed after onComplete in IE
Am Freitag, 30. Dezember 2005 12:18 schrieb Nicolas:> Hi, > > You should better use Responders.register, for example : > > Ajax.Responders.register({[...] Hi Nicolas, now that is a nice solution. Thanks alot for pointing it out. -- Dirk Eschler zeitform Internet Dienste mailto:eschler-zc1r9W/44D4b1SvskN2V4Q@public.gmane.org Fraunhoferstraße 5 PGP S/MIME: http://key.zeitform.de/ap 64283 Darmstadt, Germany Tel./Fax: +49 (0) http://www.zeitform.de