I’m trying to use for the first time the autocomplete feature of jquery ui, but I can’t get it to work properly
javascript code:
$("#search_input").autocomplete({
source: function(request, response) {
$.getJSON( "do.php", { OP: "news_search", category: cat_id, get: request }, function(result){
/*response($.map(result, function(item) {
return item.NAME;
}));*/
response(result);
console.log(result);
})
},
minLength: 2
});
It returns data, but it won’t show up: http://i46.tinypic.com/1z85c0.png
I’ve even tried adding some css to see if it works:
.ui-autocomplete{
position: absolute;
z-index: 1000;
border: 1px solid red;
}
I ended up reading this article: http://net.tutsplus.com/tutorials/javascript-ajax/how-to-use-the-jquery-ui-autocomplete-widget/
So this is how I use it and it works: