I have one client that I'm writing some box office software for. My login page for them was done AJAX style. Because it is not quite done yet, there is no ssl certificate and thus, no ssl. Albeit the chance for a man-in-the-middle attack is slim, I actually do not send the password in my authentication request. Instead, on the client side, I hash the username, password, and some client-side random salt (as random as javascript gets I guess.) I then send: the username, my hashed value, and the salt via AJAX to the server (the salt gets stored in the database and cannot be replayed.) Then, serverside, I look up the username in the database. I take the username and salt (that I know already from the POST or GET) and the password in the database (password is not hashed, but I am using their database design, not mine) and I hash that (this time with php of course) and compare that with the hash that I received. If they match, I set a session variable signifying a successful login. I then send a "success" signal back to the javascript handler for the AJAX call. Because the browser acquired a session cookie, either by just loading the login page, or by sending the AJAX request, when the javascipt is instructed to proceed to the homepage, the serverside code can check the session and allow the subsequent scripts to proceed.
Why did I just type all of this? 🙂 Well, I wanted to show an example of using AJAX for authentication without compromising the end-users ability to inject javascript code. For example, a hacker could instruct the script to proceed to the homepage (spoof the "success" message), but since the checking and session setting are server-side, he or she won't get in. The best the hacker can do is get an authenticated session cookie by being man-in-the-middle. The only thing that defeats man in the middle, is ssl.
Ashley is right, you don't want to rely on javascript authentication only. However, with the captcha you are doing, this may be a good way to thwart spam bots.