--
Martín Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador
new Ajax.Updater('foo','bar.php', {
onCreate: function(){
$('indicator').show();
},
onComplete: function(){
$('indicator').hide();
}
});
Another trick I like is this one:
new Ajax.Updater('foo','bar.php', {
onCreate: function(){
$('foo').update('<img src="indicator.gif" width="16" height="16"
alt="wait" />');
}
});
That way your update naturally wipes away the indicator, and you don't
have to manage another image in your layout.
If you want it for all the Ajax on your page, have a look at the
Prototype docs for the bit on Ajax.Responders. There's a nice recipe
there to show a global Wait indicator that comes and goes as any Ajax
on your entire page runs. I do this with a lightbox-style overlay on
the page, makes a nice effect and keeps the stray extra clicks from
happening, which was a big problem with this page.
Walter
> --
> You received this message because you are subscribed to the Google
> Groups "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-s...@googlegroups.com
> .
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
> .
>
http://scripty.walterdavisstudio.com/ajaxwait.html
Clicking the yellow box requests a PHP script that begins with
sleep(2), just so there's enough time for you to see the spinner. I
did it without that, and it was such a brief flash that you couldn't
tell that the image was being shown. All the script is inline.
Walter
Walter