Here's my issue : using an autocomplete jQuery plugin, I'd like to avoid multiple ajax requests when user strikes his keynoard by surrounding the
$('#query1').autocomplete({
serviceUrl:'/actions/autocomplete?population=salon',
minChars:3,
maxHeight:300,
width:200,
clearCache:true,
onSelect: function(suggestions,data){ $(".btn1").attr("href", "${pageContext.request.contextPath}/actions/espaceClients?participantId=" + data) }
});
with something like
var search = false;
$('#query1, #query2, #query3').keyup(function(){
if (!search){
search = true;
}
if (search) {
search = false;
autocompleteThem();
}
});
A you can see, above code is stupid, but it kinda shows what i'm trying to do.
In simple words, if user dosen't type anything else in a certain period of time, then you can call autocomplete.
I hope i'm being clear, as my brains are a mess...