i'm trying search customer data jquery autocomplete. have following scenario.
customer name , mobile number should display list selection , on selection, have display customer name autocomplete textbox.
have tried following code, won't work.
$("#txtservicecustsearch").autocomplete( { source: function (request, response) { $.ajax({ url: '<%=resolveurl("~/autocomplete.asmx/getservicecustomer") %>', data: "{ 'prefix': '" + request.term + "'}", datatype: "json", type: "post", contenttype: "application/json; charset=utf-8", success: function (data) { $("[id*='grvhistory']").empty(); response($.map(data.d, function (item) { return { label: item.split('$')[0], val: item.split('$')[1], val1: item.split('$')[2], val2: item.split('$')[3], val3: item.split('$')[4], val4: item.split('$')[5], val5: item.split('$')[6], val6: item.split('$')[7], val7: item.split('$')[8] } })) }, error: function (response) { alert(response.responsetext); }, failure: function (response) { alert(response.responsetext); } }); }, select: function (e, i) { $("#txtserviceaddress").val(i.item.val); $("#txtpincode").val(i.item.val1); $("#txtservicecontactno").val(i.item.val2); $("#txtlandmark").val(i.item.val3); $("#txtemailid").val(i.item.val4); $("#txtservicedob").val(i.item.val5); $("#txtservicemobileno").val(i.item.val6); $("#txtservicecustsearch").val(i.item.val7); }, close: function (e, i) { }, minlength: 3 });
add
e.preventdefault()in select: function (e, i)
Comments
Post a Comment