Check the Responders class...

http://www.sergiopereira.com/articles/prototype.js.html#Ajax.Responders

You can register your callback function to hide the div there.

-Jerod

On 8/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

I'm new to the forum and I have what I assume will be a basic question for
a lot of you...

I am using Ajax.Updater to make async calls to my service.  I am calling
the same function three times so I can populate three different divs.  My
issue is I would like to have a loading indicator that shows when I start
and doesn't hide until the last call is complete.  Below is my function:

As you can see, I have a call to checkAllCalls() which is my attempt to
hide the indicator only after everything is loaded.  It works but only
ocassionally.

Just curisous if someone has a better approach.  I just want to show one
indicator for all three calls that disappears when all the data is loaded.


function executeCall(day, inDiv, inURL, inParams, inSync) {
            reqDay = day;

            var opt = {
                  method: 'get',
                  postBody: inParams,
                  on404: function(t) {
                        alert('Error 404: location "' + t.statusText + '"
was not found.');
                  },
                  onFailure: function(t) {
                        ErrorHandler(t);
                  },
                  asynchronous: inSync
            }
            new Ajax.Updater(inDiv + 'Container', inURL, opt);

            setTimeout('checkAllCalls()', 1000);
      }

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to