Yes please! This was the first thing I noticed, maybe my netbook is too slow but I do a lot of coding on the little thing.
The way I solved this in a similar auto-complete app was using a setTimeOut to prevent updating or requesting data unless no key had been pressed in the last 0.2 seconds or so:
var updateId = 0;
function searchKeypress(e) {
if ((e || window.event).keyCode == 13) {
updateCookie(radioStations.selected);
document.location = radioStations.selected.links[0].url;
}
clearTimeout(updateId);
updateId = setTimeout(searchUpdate, 200);
}
Disclaimer: this piece of code is about 4 years old and as you can see it doesn't even use jQuery, but I trust it demonstrates the principle well enough.
The way I solved this in a similar auto-complete app was using a setTimeOut to prevent updating or requesting data unless no key had been pressed in the last 0.2 seconds or so:
Disclaimer: this piece of code is about 4 years old and as you can see it doesn't even use jQuery, but I trust it demonstrates the principle well enough.