title: jquery, AJAX form submit not working. Page crashes
body: <p>I'm trying to get a submit form without reloading the page.</p>
  
  <p>Here's the script:</p>
  
  <pre><code>$(function() {
      $("#submit").click(function() {
          var email = document.getElementById('emailaddress');
          var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
          if (!filter.test(email.value)) {
              $('#invalidmail').show();
              var t=setTimeout(function(){$('#invalidmail').fadeOut("slow");},2000);
              email.focus;
              return false;
          } else {    
              $.ajax({
                  type: "POST",
                  url: "traces_form_handler.cgi",
                  data: email,
                  success: function(){
                      alert("success!");
                  }
              });
              alert("success!");
              return false;
          };
  
        });  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>and here's the html</p>
  
  <pre><code>&lt;form name="form" method="post"&gt;
      Email: &lt;input type="text" name="email" id="emailaddress" /&gt;
      &lt;input type="submit" value="Submit" id="submit"/&gt;
      &lt;/form&gt;        
     &lt;p id="invalidmail"&gt;Ops! The address you provided is not valid. Please retry.&lt;/p&gt;
  </code></pre>
  
  <p>it works till the invalid mail part but if i submit a valid email address, the browser crashes.</p>
  
  <p>Any suggestion?</p>
  
  <p>Thanks</p>