1
Well, I’m trying to implement the jQuery UI in my code, but partially it does not work because it does not display the options below the component of input. It performs of being correct the request, but when showing the options on the screen comes blank. I’m pretty sure that’s the way I’m sending my JSON for the attribute source of plugin.
Below follow the codes:
O Input
<div class="ui-widget">
<input id="first-name" placeholder="Primeiro Nome" name="firstName" type="text" class="form-control"/>
</div>
JS Code
$(document).ready(function () {
$(function () {
$("#first-name").autocomplete({
source: function (request, response) {
$.ajax({
url: "${pageContext.request.contextPath}/auth/getCustomerAJAX",
type: "GET",
data: {
paramName: request.term
},
dataType: "json",
success: function (data) {
var obj = JSON.parse(data);
alert(obj);
response(obj.firstName);
}
});
}
});
});
});
The callback (Disregard the NULL)
[
{
"idCustomer":1,
"tenantId":null,
"birthDate":null,
"email":"[email protected]",
"firstName":"j",
"gender":"\u0000",
"lastName":"Galao Bonin",
"document":null,
"customerPhone":null,
"passenger":null,
"customerAddress":null,
"observations":null,
"customerService":null
}
]
Cool Maison! That can only be right. I will test as soon as possible and soon pass you the feedback.
– João Manolo