jfergy
asked on
Jquery UI AutoComplete On Key Up
hello-
I am using JqueryUI Auto Complete which works fine for simple things, however I need it to return values on every keystroke after the minimum entered. Right now, JqueryUI only returns the data from the first" minLength" entered. So what I need it do is:
Continue to hit my server with every key stroke after the minimum so the user continues to see the list change as they input text. Any help is appreciated.
I am using JqueryUI Auto Complete which works fine for simple things, however I need it to return values on every keystroke after the minimum entered. Right now, JqueryUI only returns the data from the first" minLength" entered. So what I need it do is:
Continue to hit my server with every key stroke after the minimum so the user continues to see the list change as they input text. Any help is appreciated.
<script>
$(function() {
var cache = {},
lastXhr;
$( "#addresses" ).autocomplete({
minLength: 4,
source: function( request, response ) {
var term = request.term;
if ( term in cache ) {
response( cache[ term ] );
return;
}
lastXhr = $.getJSON( "addresses.asp", request, function( data, status, xhr ) {
cache[ term ] = data;
if ( xhr === lastXhr ) {
response( data );
}
});
}
});
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER