假设您是dojo.xhrGet()
.Make 通用方法,您可以在其中传递您的 URl 和要调用的调用函数。
var processDialog = new dijit.Dialog({
title : ""
}); //make it Global
function sendRequest(requestUrl, sucessFunction, errorFunction) {
dojo.xhrGet({
preventCache : "true",
url : requestUrl,
load : function (){
showProgressDlg(processDialog,true);
sucessFunction; //Call showProgressDlg(processDialog,false) once your job done inside this call back method.
},
error : function (){
showProgressDlg(processDialog,false);//If Any loading image present
errorFunction;
},
handleAs : "json"
});
}
function showProgressDlg(imgContent /*Pass Your Icon URL*/, isShow) {
if (isShow == true) {
processDialog .attr("content", imgContent);
dojo.body().appendChild(processDialog .domNode);
processDialog.titleBar.style.display = 'none';
processDialog.startup();
processDialog.show();
} else {
if (processDialog )
processDialog.hide();
}
}