jquery ui autcomplete does not disapper with no result
- by mike
Hi,
I'm using jquery ui autocomplete with the following code:
$('#company').autocomplete({
source: function(request, response) {
var company_name = $('#company').val();
$.ajax({
type: 'post',
url: 'http://new.admin.localhost/client/helper/lookup_company_name',
cache: false,
data: { company : company_name },
dataType: 'json',
success: function(data) {
//alert(data);
response($.map(data.companies, function(item) {
return {
label: item.company,
value: item.company
}
}))
}
})
},
minLength: 2,
});
This works as expected... The problem is, if the first few chars match something and then you enter a char that should "break" any match, it just keeps the drop down in place with the results for the last matched char... make sense? Would this be something I needed to change in the script that returns the data or something in the jquery?
thanks!