jquery-ui - 删除自动完成错误的微调器/加载图像

标签 jquery-ui jquery autocomplete

如果自动完成出现错误/失败情况,您能否帮助我了解如何删除旋转器/加载图像?

如果我收到错误“由于意外错误,我们无法加载数据”,我会看到正在加载的图像,并且我想删除该图像。

下面是片段

  $("Autotxt").autocomplete({
    source: function (request, response) {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "Webservice.asmx/GetNames",
            data: "{'prefixText':'" + request.term + "'}",
            dataType: "json",  
            success: function (data) {
                response($.map(data.d, function (item) {

                    return {
                        label: item.split('|')[0],
                        val: item.split('|')[1]
                    }
                }))
            },

            error: function (result) {

                alert("Due to unexpected errors we were unable to load data");
                ServiceFailed(result);
            },
            failure: function (response) {
                alert("Due to unexpected errors we were unable to load data");

            }
        });
    },
    select: function (event, ui) {
        txtSoID(ui.item.val);
    },
    minLength: 4
});


function txtID(val)
{
alert(val)
}

最佳答案

如果您指的是通过 ui 提供的加载类,您应该能够执行以下操作:

 error: function (result) {
     $('.ui-autocomplete-loading').removeClass("ui-autocomplete-loading");
     // or .hide()
     alert("Due to unexpected errors we were unable to load data");
     ServiceFailed(result);
 },

我在 jqueryUI development site 上找到了类(class)信息在页面底部,他们讨论 CSS 和主题。

关于jquery-ui - 删除自动完成错误的微调器/加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9261692/

相关文章:

javascript - 成功回调没有执行?

javascript - 让文字脉动 jQuery

google-maps - 自动完成受边界限制的位置(城市和邮政编码)(完全限制)

autocomplete - 我可以在 zsh 中使用 kubectl 自动补全功能吗?

c++ - 如何在 intellij IDEA 的 Android 项目中为 C/C++ 启用自动完成和语法突出显示?

jquery - 你能 !important 整个 css 文件吗?

jquery - 无法设置 jqueryUI 对话框关闭按钮的事件状态的样式

JavaScript:从弹出窗口获取值(外部网站)

javascript - jquery-ui 向左滑动第一次不起作用

jquery - 如何通过 jQuery 更改 SVG 元素的颜色(拖动选定的颜色)