HTML:
<input type="text" id="shop-id">
JS:
$(document).ready(function(){
$( "#shop-id" ).autocomplete({
source: "/ticket/get_sids",
select: function(event, ui){
//...
}
});
});
There is a strange autocomplete issue. If I declare the source with a static variable like this
var data = ["0200","0032"];
$( "#shop-id" ).autocomplete({
source: "/ticket/get_sids"
});
everything is like expected.
But with the dynamic source url the autocomplete does not seem to filter the search. It's like no matter what I input as search text, autocomplete opens the entire source without filtering. E.g. I type a "g" and it opens 0200, 0032 but it shouldn't because "g" does not match anything in the source.
The dynamic source returns pure json like: ["0200","0032"]. It's a php page:
return new Response(json_encode($data));
which returns
["0200","0032"]
in the browser window.
Environment: jQuery 1.7.2 jQuery-Ui 1.8.2