AJAX user validation

AJAX user validation

I'm creating an AJAX user validation so that when a user types in a username, it checks it in the database to see if it exists. I want it to execute after the user finishes typing.

I've tried using:
$("#username_field").keyup(function(){
which works, but I don't want a query executed every time the users presses a key. I was wondering if there was a better way to do it. Meaning I what the check to be preformed after the user finishes typing.
Thanks,

Zeeshan Syed
Web Programmer
http://www.bdqworks.com