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
| $("input#a").autocomplete({
source: function (request, response)
{
$.ajax({
url:'../sky/',
dataType: "json",
type: "POST",
data:"term="+$('#a').val(),
success: function (data) {
response($.map(data, function (item) {
return{
id: item.id,
label: item.,name + " " + item.prenom + " ( " + item.mail + " )",
value: item.name + " " + item.prenom + " ( " + item.mail + " )"
}
}));
},
error: function (XMLHttpRequest, callStatus, errorThrown) {
alert(callStatus);
}
});
},
minLength: 3,
select: function (event, ui) {
$("#a").val(ui.item.id);
}
}); |
Partager