It doesnt matter what i type into the textbox, always shows the whole list. Heres my code:
$("#tb_country").autocomplete({
source: function(request, response) {
$.ajax({
url: "/index.php/ajax_calls/select_countries",
dataType: "json",
data: request,
success: function(data) {
response(data);
}
});
},
minLength: 3
});
The select_countries function returns JSON data in the right format for autocomplete i.e. [{“label”:”United States”},{“label”:”Canada”}……..]
Please can someone tell me whats wrong with this, thanx
Make sure you actually filter your response in the server-side code, as described here:
You do send the correct request (with
termparam filled by the current value ofinputelement), but most probably don’t use it in the server code.