Status Messages

Table of Contents

Triggering Loading Messages
Hiding Loading Messages
Triggering Status Updates
Hiding Status Messages

When developing Ajax-powered applications it is important to keep users informed when background actions are occurring. If they don't know that something is happening when they expect something to be happening they might grow impatient or give up.

To keep users informed, Recite provides a mechanism for displaying status messages. There are two types of status messages that can be displayed:

Many status messages are triggered automatically from responses to Ajax requests. For more information on how send status messages from Ajax requests refer to the Ajax Requests chapter.

Triggering Loading Messages

To display a loading message, use the following code:

Recite.Delegate.trigger('loadstart.status');

This will display a status message that says Loading.... You can display a custom message by passing an object with a string called msg as the second argument to trigger().

For example, to display the message Doing something..., you would use the following code:

Recite.Delegate.trigger('loadstart.status', { msg : 'Doing something...' });

By default the status message will be attached to the main browser window. If you want to attach it to a different element you can pass the parent DOM element in the parent element of the second argument.