如何实现 jQuery Ajax 调用的 Kendo 进度条

How to implement the Kendo Progress bar for jQuery Ajax call?

本文关键字:调用 Kendo Ajax jQuery 何实现 实现      更新时间:2023-09-26

我的要求是在jQuery Ajax调用启动时显示剑道进度条,然后在我得到响应时显示剑道进度条我需要关闭进度。响应可能是成功或错误,但对于这两种情况,我都需要关闭进度条。

请为此提供任何示例。

谢谢。

请尝试以下代码,在调用ajax之前,启动进度条并停止进度条ajax complete因为它将运行,无论响应如何successerror

  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
            }
        });
 }