i am using jquery ui v1.10.3 and style v1.10.3 library. jquery klibrary version is v1.9.1
this is my text box
<input type="text" name="txtCustomer" id="txtCustomer" />
and i have this js
$("#txtCustomer").autocomplete({
source: function (request, response) {
$.ajax({
url: '/kpanel/handlers/content.aspx?act=getCustomer&d=' + d,
dataType: 'json',
data: { name: encodeURI(request.term) },
success: function (z) {
response($.map(z.Data, function (item) {
return {
label: item.Name,
value: item.Name
}));
}
});
},
select: function (event, ui) {
$("#lblType").html(ui.item.TypeName);
$("#lblCode").html(ui.item.CustomerCode);
},
open: function () {
$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
},
close: function () {
$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
}
});
and this is my result Json Data
{
"Data": [
{
"Name": "Kolya Husten",
"CustomerCode": "MT20132645",
"TypeName": "Normal",
"Email": "kolya@husten.com",
"Telephone": "0(234)567-89-45",
"MobilePhone": "0(234)567-89-76",
"DiscountRatio": "0"
},
{
"Name": "Loya Mantus",
"CustomerCode": "MT20132602",
"TypeName": "Normal",
"Email": "loya@mantus.com",
"Telephone": "0(212)268-02-22",
"MobilePhone": "0(536)448-96-67",
"DiscountRatio": "10"
}
]
}
everything look good but result is not displayed as shown image
i have found the error.
in my style.css file i have this line
body { background: #fff; color: #393939; font-family: Arial; font-size:0px; line-height: 0; }
because of font-size property result list was not shown. i changed this line like this.
body { background: #fff; color: #393939; font-family: Arial; line-height: 0; }
and it worked.
thanks anyway.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.