[英]How to get the full data list from auto complete function on textbox?
I have used autocomplete function on textbox,on typing any letter it populates the data list,but i want to populate the total data list on click on the textbox without typing any letter inside the textbox. 我在文本框上使用了自动完成功能,在键入任何字母时它会填充数据列表,但是我想在单击文本框时填充总数据列表,而不在文本框内键入任何字母。 Here is the code i have used:
这是我使用的代码:
<script type="text/javascript">
$(document).ready(function () {
$("#<%=Searchtxt.ClientID %>").autocomplete({
source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/WebService.asmx/Get") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
scroll: true,
scrollHeight: 180,
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},
select: function (e, i) {
$("#<%=bHdn.ClientID %>").val(i.item.val);
},
minLength: 1
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.