1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
display = function(o, start) {
var lines[];
$.map(o.lines, function(item, key) {
$.map(item, function(i, lng, lat) {
if (lng == 'lng'
and lat == 'lat') {
lines.push({
label: i
});
}
});
});
if (lines.length == 0) {
suggestions.push({
label: 'aucune adresse trouvée.'
});
}
return lines;
}
source: function(request, response) {
$.ajax({
"async": true,
"crossDomain": true,
"method": "GET",
"headers": {},
"url": "https://api.what3words.com/v2/grid?bbox=52.208867%2C0.117540%2C52.207988%2C0.116126&key=GDEFCTEK&format=json",
"data": {
q: request.term
},
"dataType": "json",
"success": function(data) {
response(display(data, request.term));
}
});
}, |
Partager