I have the following code that works perfectly :
$("#element1").autocomplete({
source: function (request, response) {
$.ajax({
url: "https://jsonurlworks.com",
type: "GET",
data: { q: request.term },
//data: request,
success: function (data) {
response($.map(data.data, function (el) {
return {
label: el.name,
value: el.country_code,
size: el.audience_size
};
}));
}
});
},
select: function (event, ui) {
// Prevent value from being put in the input:
this.value = ui.item.label;
// Set the next input's value to the "value" of the item.
// $(this).next("input").value(ui.item.value);
$('#asize').text("("+ui.item.size+")");
event.preventDefault();
}
});
Well it shows the list of el.name. I would like to add size right next to name. for example Title (#18374),something along these lines. any suggestions please?