How do you override an existing html form to use jquery to post the form?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-06-03T14:52:43Z Indexed on 2010/06/03 14:54 UTC
Read the original article Hit count: 228

Filed under:
|

I have a simple form that I am currently posting back to the server to update a nickname. What jquery code do I add (without changing the form) so that the page will not refresh, but instead jquery will post the form in the background and then pop up an alert message containing the reply back from the server?

<form method="post" action="http://www.myserver.com/update_nickname" name="input">
    Quick form to test update_nickname:<br>
    New nickname:<input type="text" value="BigJoe" name="newNickname"><br>
    <input type="submit" value="Submit">
</form>

<script src="jquery-1.4.2.min.js" type="text/javascript"> </script>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery