// I need to pass lastVall to autoComplete, but it "arrives" undefined searchField.keyup(function(event){ lastVal = searchField.val(); setTimeout(function(event, lastVal){ autoComplete(event, lastVal); }, 500); });