Using xajax 0.5 beta 2, you can now use the following (callback objects)

Using xajax 0.5 beta 2, you can now use the following (callback objects) to accomplish this:

loadingPage = xajax.callback.create(300, 10000);
loadingSomeSelectOptions = xajax.callback.create(300, 10000);
loadingOtherSelectOptions = xajax.callback.create(100, 10000);

Then, provide the operations to perform:

loadingPage.onResponseDelay = function() { ... show loading message ... }
loadingPage.onComplete = function() { ... hide loading message ... }

loadingSomeSelectOptions.onRequest = function() { ... show loading message over select box ... }
loadingSomeSelectOptions.onComplete = function() { ... hide loading message ... }

loadingOtherSelectOptions.onResponseDelay = function() { ... show loading msg over other select box ... }
loadingOtherSelectOptions.onComplete = function() { ... hide loading message ... }

Then:

xajax.call('loadPage', { callback: loadingPage });
xajax.call('loadSomeSelectOptions', { callback: loadingSomeSelectOptions });
etc...

As an alternative, you could even:

showLoading = function(oRequest) {
if ('loadPage' == oRequest.functionName) { ... show page loading message ... }
else if ('loadSomeSelectOptions' == oRequest.functionName) { ... show loading message over select ... }
}

hideLoading = function(oRequest) {
if ('loadPage' == oRequest.functionName) { ... hide page loading message ... }
else if ('loadSomeSelectOptions' == oRequest.functionName) { ... hide loading message ... }
}

handleLoadingMessage = xajax.callback.create(400, 10000);
handleLoadingMessage.onResponseDelay = showLoading;
handleLoadingMessage.onComplete = hideLoading;

xajax.call('loadPage', { callback: handleLoadingMessage });
// add description
myCallBackObject = xajax.callbacks.create( *1, *2 )
*1 = response delay time
*2 = expiration timeout
both are optional
Hope that helps.

Nhận xét

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

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

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

Ubuntu LAMP Server