I did an autocomplete request with jquery and ajax, i requested the object, they appear into the preview tab in "network" but i got stucked at writing them into the html...
$(document).ready(function() {
$("#autocomplete").autocomplete({
source: function(request, response) {
$.ajax({
method: "GET",
dataType: "jsonp",
url: "https://www.blalba/?term=" + request.term,
success: function(data) {
var transformed = $.map(data.Search, function(el) {
return {
label: el.airport,
id: el.city
};
});
response(transformed);
},
error: function() {
response([]);
}
});
}
});
}); <
objects for every request appear like this
[{"airport":"Toate aeroporturile","city":"Roma","country_code":"IT","country":"Italia","airport_code":"ROM","city_code":"ROM","sort":27428841,"c2":0,"hidden_code":true},{"airport":"Ciampino","city":"Roma","country_code":"IT","country":"Italia","airport_code":"CIA","city_code":"ROM","sort":25428841,"c2":1,"sub":true},{"airport":"Fiumicino","city":"Roma","country_code":"IT","country":"Italia","airport_code":"FCO","city_code":"ROM","sort":25428841,"c2":2,"sub":true},{"airport":"","city":"Roma","country_code":"AU","country":"Australia","airport_code":"RMA","city_code":"RMA","c2":0,"sort":36969,"hidden_code":true}]
Any help would be very much appreciated !!