Alright, I’m working on a login form. I want it to have AJAX capability, while making it compatible with those with JavaScript turned off, so I have something like this:
[code]
<form action=”” method=”POST” onsubmit=”sendAjax(); return false; “>
Username: <input type=”text” name=”username” />
Password: <input type=”password” name=”password” />
<input type=”submit” name=”submit” value=” Login ” />
</form>
Everything alright so far? So, the idea is, the form submits to itself, but, if the user has JavaScript enabled, the form will, instead, be sent by AJAX to the server.
My problem is, how do I build up the post headers in JavaScript to send to the server? Or, do they do that automatically, since it’s an onsubmit trigger?