I’ve got a search field. Right now it searches for every keyup. So if someone types “Windows”, it will make a search with AJAX for every keyup: “W”, “Wi”, “Win”, “Wind”, “Wi
var globalTimeout = null; $('#search').keyup(function(){ if(globalTimeout != null) clearTimeout(globalTimeout); globalTimeout =setTimeout(SearchFunc,200); }); function SearchFunc(){ globalTimeout = null; console.log('Search: '+$('#search').val()); //ajax code };