首页 > 其他 > 详细

文本框根据关键字异步搜索内容

时间:2018-10-12 15:26:50      阅读:193      评论:0      收藏:0      [点我收藏+]
$(_this).autocomplete({
    //定义要使用的数据,必须指定。
source: function (request, response) {
if ($(_this).val() == null || $(_this).val() == "") {
return;
}
$.ajax({
url: url,
method:"post",
dataType: "json",
data: {key: request.term},
success: function (data) {
response($.map(data, function (item) {
return {
label: item.name,
value: item.name,
id: item.id,
}
}));
}
});
},
minLength: 1,  //户必须输入的最小字符数
delay: 10,    //按键和执行搜索之间的延迟,以毫秒计
select: function(event, ui) {
this.value = ui.item.label;
$("#creditProductId").val(ui.item.id);
return false;
}
});

技术分享图片

 

文本框根据关键字异步搜索内容

原文:https://www.cnblogs.com/gqymy/p/9778168.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!