如果自动完成出现错误/失败情况,您能否帮助我了解如何删除旋转器/加载图像?
如果我收到错误“由于意外错误,我们无法加载数据”,我会看到正在加载的图像,并且我想删除该图像。
下面是片段
$("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/