【问题标题】:How to implement the Kendo Progress bar for jQuery Ajax call?如何为 jQuery Ajax 调用实现剑道进度条?
【发布时间】:2016-02-25 06:32:49
【问题描述】:

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

请为此提供任何示例。

感谢您。

【问题讨论】:

    标签: javascript jquery ajax kendo-ui


    【解决方案1】:

    请尝试以下代码,在调用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
                }
            });
     }
    

    【讨论】:

    • 非常感谢。是否可以使用上面的代码给出任何工作示例?
    • @bagya 检查这个fiddle.jshell.net/qy6sgmpq/14 。从您的实际代码中删除 setTimeout
    • 请看这个小提琴。它不适用于实际代码。 fiddle.jshell.net/5s9box71/1。你能就此提出建议吗?
    • @bagya url file.fileUrl 不正确。您可以在 chrome 控制台中看到错误。
    • File.fileurl 它是一个服务器端的 url。这不是一个问题。进度条未启动。在运行我的应用程序时。如果我设置了超时,那么它就来了。我会要求您提供没有超时功能的解决方案,如果您想使用 url,请按照您的意愿使用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-12
    相关资源
    最近更新 更多