$('.txtAlignLeft').live('focus.autocomplete', function(){
var $textBox = $(this);
var curId = $textBox.attr("id");
var vtxtmtlCode = $('#txtmtlCode').val();
pmidvalue = (curId).replace( /(^.+\D)(\d+)($)/i,'$2');
$(this).removeData('events').autocomplete(gMasterAjaxPath+"filename.php?vValid=3",{
//delay:10,
minChars:1,
//cacheLength:20,
//mustMatch:true,
matchContains: true,
mustMatch: false,
//selectFirst: false,
extraParams: {
txtmtlCode: function() {return $('#txtmtlCode').val()},
},
formatItem: function(data, i, n, value) {
return value.split("#-#")[0]
},
formatResult: function(data, value) {
return(value.split("#-#")[0]);
}
}).result(function(event, item, data) {
// Result updation
});
});
当我在输入框中键入单个字符时,数据库命中发生了 10 到 20 次以上(在控制台中)。而且当我单击其他选项卡或文本框时,数据库会持续不断地运行..我该如何解决这个问题..我的代码有什么错误吗