【发布时间】:2016-02-25 06:32:49
【问题描述】:
我的要求是在 jQuery Ajax 调用开始时显示剑道进度条,然后一旦我得到响应 我需要关闭进度。响应可能是成功或错误,但对于这两种情况,我都需要关闭进度条。
请为此提供任何示例。
感谢您。
【问题讨论】:
标签: javascript jquery ajax kendo-ui
我的要求是在 jQuery Ajax 调用开始时显示剑道进度条,然后一旦我得到响应 我需要关闭进度。响应可能是成功或错误,但对于这两种情况,我都需要关闭进度条。
请为此提供任何示例。
感谢您。
【问题讨论】:
标签: javascript jquery ajax kendo-ui
请尝试以下代码,在调用ajax 之前启动进度条并在ajax complete 中停止进度条,因为无论响应为success 或error,它都会运行。
function StartProgessBar() {
kendo.ui.progress($("#progessbardiv"), true); //Here progess bar will intiate
$.ajax({
type: "POST",
url: "",
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
//no need to close the progess bar here as we have handling it in complete
},
error: function () {
////nor need to close the progess bar here as we have handling it in complete
},
complete: function () {
kendo.ui.progress($("#progessbardiv"), false); //close the progress bar
}
});
}
【讨论】:
setTimeout
url file.fileUrl 不正确。您可以在 chrome 控制台中看到错误。