Hello, When using AJAX, in rails, is there any way to have a "Please wait while loading" page until content arrives ? thanks adam
> When using AJAX, in rails, is there any way to have a "Please wait > while loading" page until content arrives ?Wasn''t the point of ajax to have instant actions? Yes there is a way. Whether rails has a built in facility for the way you happen to want to do it is another question entirely. Personally, I find it easy to just show a ''loading'' div on the loading callback and hide it with the complete callback of the ajax request. The ''mac spinner'' icon seems to be popular for this. There''s no reason why this can''t be text, or anything you dream of with javascript. I also make it a point to hide the ajax links right after submitting. You can see some odd effects by double clicking ajax links that don''t fade immediately. -- rick http://techno-weenie.net
Yeah, why not have it first load a page that says please wait, then have that page do the task? On 18/08/2005, at 1:05 AM, Adam Denenberg wrote:> Hello, > > > When using AJAX, in rails, is there any way to have a "Please wait > while loading" page until content arrives ? > > thanks > adam > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
+1 If you just want to load an entire page, by all means don''t use AJAX. If you use AJAX for page fragments or behind-the-scenes stuff, it depends on the application, so using :loading => / :complete => is a fine way to add your specific handling for this. if you need it for _all_ calls, the best way is probably to add a customized wrapper helper. the most basic usage pattern would be to add :loading => "$ (''id_of_element_to_update'').innerHTML = ''Loading...''" to calls the use :update. maybe this is something to add to prototype directly (callbacks that get called for _all_ AJAX requests, in addition to the per-request callbacks). Thomas Am 17.08.2005 um 17:57 schrieb Rick Olson:>> When using AJAX, in rails, is there any way to have a "Please wait >> while loading" page until content arrives ? >> > > Wasn''t the point of ajax to have instant actions?
Julian Leviston wrote:> Yeah, why not have it first load a page that says please wait, then > have that page do the task?Extremely simple way: page background "loading..." image that gets changed or even just covered over once the full content has loaded. ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/