[Javascript] Using XMLHttpRequest

Ok lets start. I have been writing Javascript and using an XMLHttpRequest object to talk to the server.
In my HTML code, I have a form input field defined by the following:[COLOR=black]

[/COLOR]

<input type="text" name="usr" onKeyUp="validateField(this)" />

[COLOR=black]

[/COLOR]
As you can see, every time the user releases a key the JS function validateField() is executed. Now that validateField() function is the one which defines an XMLHttpRequest object and connects to my database, searching the username’s to see if there is a match. So every time a key is released, the script connects, SQL queries,
and returns. I dont know what kind of load all those constant calls are putting on the server, but it cant be good… right?

The question I pose is how can this be made more ‘efficient’ from the servers point of view?
Not to part answer my own question, but I would guess that I should, straight off the bat, connect to the database, search and store all the current username’s into a JS array and then just using the array whenever the function is called.
Would there be security risks with that though? I mean, I’ll be giving the client an array with all the users logon names…

Any opinion on this is much appreciated.

SpyrL