You can register the so-called Ajax.Responder globally for the Prototype Ajax onLoading event. This will fire for every remoteFunction / Ajax call on your page. To do this, you should put something like this on the gsp page or layout:
<script type="text/javascript">
function showSpinner() {
}
function hideSpinner() {
}
Ajax.Responders.register({
onLoading: function() {
showSpinner();
},
onComplete: function() {
if(!Ajax.activeRequestCount) hideSpinner();
}
});
</script>
, showSpinner hideSpinner. - :
<script type="text/javascript">
function showSpinner() {
$('spinner').show();
}
function hideSpinner() {
$('spinner').hide();
}
Ajax.Responders.register({
onLoading: function() {
showSpinner();
},
onComplete: function() {
if(!Ajax.activeRequestCount) hideSpinner();
}
});
</script>
<div id="spinner" style="display: none;">
<img src="${createLinkTo(dir:'images',file:'spinner.gif')}" alt="Loading..." width="16" height="16" />
</div>