show the message & hide the message

Often, we want to notify the end user that an operation is in process; to let them know they may need to wait a bit for the operation to finish.
First, let's define the message, what to do to show the message and what to do to hide the message:

and later (in the HTML of the page):
Loading, please wait a moment...

----------
With xajax 0.2.4 (the current release), you can accomplish this with the following javascript code:

----------
With xajax 0.5 (the current beta release), you can accomplish this with the following javascript code:
on a global level:

on a per call basis:

Indeed, same question. Would it be loaded by onLoad?

We need a bit more information on this one.

I have a very simple .js called under my body tag, which uses a YUI Panel to display an Ajax loader icon (created with www.ajaxload.info), but I'd like to increase the delay time to about 500 milli or even one full second. Some of the database calls are slow and my users click several times sometimes, which make matters worse.

Here is the code below. Feel free to reuse.

YAHOO.namespace('example.container');

YAHOO.example.container.loader = new YAHOO.widget.Panel("loader", { width:"230px",height:"80px",fixedcenter:true,close:false,draggable:true,modal:true,visible:false} );
YAHOO.example.container.loader.setHeader('Processing, please wait...');
YAHOO.example.container.loader.setBody("
Loading...
");
YAHOO.example.container.loader.render(document.body);
showLoading = function() {YAHOO.example.container.loader.show();};
hideLoading = function() {YAHOO.example.container.loader.hide();}
xajax.callback.global.onResponseDelay = showLoading;
xajax.callback.global.onComplete = hideLoading;

Nhận xét

Bài đăng phổ biến từ blog này

dung lượng RAM lớn nhất mà HĐH cấu trúc 32-bit nhận được

Ký tự viết tắt trong chat & email

Ubuntu LAMP Server