I'm trying to use Autocomplete Widget for my autocomplete function,I receive a response with this form:
[
{"_id":{"mes":"measure1","name":"hold2"},"number":1},
{"_id":{"mes":"measure2","name":"hold3"},"number":1}
]
I'm trying to find a way to display the suggestion when typing in an input using this javascript:jquery code :
$('#q').autocomplete({
source : function(requete, reponse){
$.ajax({
url : '/app/test/testsearch/',
dataType : 'json',
data : {
queryvar : $('#q').val()
},
success : function(donnee){
//alert('success');
reponse($.map(donnee._id, function(objet){
return objet.mes + ', ' + objet.name;
}));
}
});
}
});
With this code I'm getting when I'm typing some suggestions in the input field(with id q)a success Ajax response but I cant display it,any suggestions? Thanks a lot!!!