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
|
function rechercheVille() {
$("#TXT_ADR_VILLE").autocomplete({
minLength: 0,
source: function (request, response) {
$.ajax({
url: "/Pv_Adresse/getVille",
type: "POST",
dataType: "json",
data: {
cp: $("#TXT_ADR_CP").val(),
ville: $("#TXT_ADR_VILLE").val(),
idtPays: $("#DDL_ADR_PAYS").val()
},
success: function (data) {
response($.map(data, function (item) {
return {
label: item.CPVIL_NOM,
value: item.CPVIL_NOM
}
}));
}
});
},
focus: function (event, ui) {
this.value = ui.item.label;
return false;
},
select: function (event, ui) {
this.value = ui.item.label;
return false;
}
});
} |
Partager