Saturday, 31 August 2013

jQuery autocomplete remote data using getJson with autocomplete.filter

jQuery autocomplete remote data using getJson with autocomplete.filter

Many people are using jQuery Autocomplete with a remote data source like
this:
$("#auto").autocomplete({
source: function( request, response ) {
$.getJSON( "search.php", { // get the json here
term: extractLast( request.term ) // function further, up not important
}, response );
}
});
and many people are filtering their data arrays like this:
$("#auto").autocomplete({
source: function(request, response) {
var results = $.ui.autocomplete.filter(myarray, request.term); //data in
"myarray"
response(results) ;
}
});
I can't find any example where anyone is filtering a remote data source
and I really need both. I'd like to just combine these to blocks of code
if possible.
Thanks.

No comments:

Post a Comment