How to send data after form has been validated using jQuery?

Posted by Keith Donegan on Stack Overflow See other posts from Stack Overflow or by Keith Donegan
Published on 2008-12-10T18:21:12Z Indexed on 2010/04/02 22:43 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

I have a simple email address sign up form as follows:

<form action="" id="newsletterform" method="get">
      <input type="text" name="email" class="required email" id="textnewsletter"  />
      <input type="submit" id="signup" />
</form>

Here's what I want to be able to do:

  • Validate the form to look for an empty string or a incorrectly filled out email address one the user clicks submit or hits enter.
  • If one of the above happens (empty string etc), I would like to generate an error to let the user know.
  • Then once the user fills out a correctly formed email address and hits submit (or enter) I want the form to send the email address to wherever I specify in the jQuery code and then generate a little "Thank you for signing up notice", all without reloading the browser.

I have looked at too many tutorials and my eyes are pretty much aching at this stage, so please don't point me to any urls (I most likely have been there).

If someone could provide a barebone outline of what to do It would be so much appreciated.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about validation