Keypress in javascript

Hi, can i ask how can i use keypress in javascript that query to my database…I already know how to use this in jquery.ajax but i just want to know how to use this in javascript.

function testsearch(){
  var querystring = document.getElementById('mystring').value;


<input type="text" id="mystring" name="search" onkeypress="testsearch()">

Thank you in advance.:slight_smile: