Use onkeydown () (or keyPress or keyUp, depending on the semantics), and not on click - this will give you the event with event.keyCode you want - 13, and you can easily send an AJAX request (e.g. XMLHttpRequest)
Simple code: - raw Javascript, no jQuery needed:
<html> <script> function keyPress(e) { if (!e) e = window.event; </script> <body> <input type="text" onkeydown="keyPress()" size="20"/>xx </body> </html>
source share