我正在使用图像上传器。问题是图像上传器只向我显示了一个 ajax 进度条图像,但没有任何百分比。
如何在下面的代码中实现百分比(与进度条相关)?
jQuery.itemForm.submitFormIfNotImageLoading = function(loadingTime) {
if (jQuery.uploaderPreviewer.loadingImages()) {
if(loadingTime > $.itemForm.loadingTimeout) {
var settings = {
title: $.itemForm.messages.timeoutTitle,
message: $.itemForm.messages.timeoutMessage,
buttons: { 'OK': function() { $(this).dialog("close"); } }
};
$.globalFunctions.openDialog(settings);
}
else {
loadingTime += $.itemForm.checkingIntervalTime;
var progressBarValue = $("#progressbar").progressbar('value')
+ $.itemForm.progressBarInterval;
$("#progressbar").progressbar('value', progressBarValue);
var recursiveCall = "$.itemForm.submitFormIfNotImageLoading(" + loadingTime + ")";
setTimeout(recursiveCall, $.itemForm.checkingIntervalTime);
}
}
else {
submitForm();
}
};
function showImageLoadingMessage() {
var options = {
title: $.itemForm.messages.savingTitle,
message: $.itemForm.messages.savingMessage
};
$.globalFunctions.openDialog(options);
$("#progressbar").progressbar({
value: 0
});
var progressBarInterval = $.itemForm.checkingIntervalTime * 100 / $.itemForm.loadingTimeout;
if (progressBarInterval != Number.NaN) {
$.itemForm.progressBarInterval = Math.floor(progressBarInterval);
}
};