Changed keydown to keyup.

This way you avoid always reacting to one keystroke in the past (i.e. after typing the last letter t of "test", it displays results for "tes").

Ideally, using oninput is even better (in the latest browsers that support it), because it detects all possible ways that input can be changed, e.g. cut, delete from context menu, etc.