$(function () { $('#txtCustomer').typeahead({ hint: true, highlight: true, minLength: 1, source: function (request, response) { $.ajax({ url: '/Customer.aspx/GetCustomers', data: "{ 'prefix': '" + request + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", success: function (data) { items = []; map = {}; var obj = JSON.parse(data.d); $.each(obj.Data, function (i, value) { map[name] = { id: value.CustomerID, name: value.FullName }; items.push(map[name]); }); response(items); }, error: OnError, failure: OnError, }); }, updater: function (item) { $('#hfCustomerId').val(item.id); return item; } }); });
closed
.on("typeahead:closed",function() { alert("Dropdown Closed!"); $('#hfCustomerId').val(''); $('#txtCustomer').val(''); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)