title: jquery submit not working
body: <p>I cant get this form to submit correctly. If I have the button type as "submit" it always submits and if I use "button" as the type it never submits, the ajax call brings in the correct values, so even though the <code>if</code> statement follows the correct path but it doesnt seem to matter.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){
   $("#submitButton").click(function(e) {
          var un  = $('#username').val();
          $('#mike').html("");       
              $.ajax(
              {              
                  type: "POST",
                  url: "Utilities/CheckUsername.php",
                  data: "un="+ un,
                  success: function(data2)
                  {                  
                     if(data2=="Username Does Not Exist")
                      {         
                         $("#login2").submit();                   
                      }
                      else
                      {
                          $('#mike').html(data2);
                          return false;                      
                      }                   
                  }
  
              });
               });
  
               }); 
               &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
        &lt;form name="login" id="login2" method="post" action="dsds.html"&gt;
          UserName&lt;input type="text" name="username" id="username"value=""&gt;
          &lt;br/&gt;
          Password&lt;input type="text" name="password" id="password" value=""&gt;
          &lt;br/&gt;
          Password Again&lt;input type="text" name="passwordagain" id="passwordagain" value=""&gt;
          &lt;br/&gt;
          &lt;input type="hidden" name="NewClass" id="NewClass" value="true"&gt;
          &lt;br/&gt;
          &lt;input type="submit" name="no" id="submitButton" value="submit"&gt;
       &lt;/form&gt;
       &lt;span id = "mike"&gt;&lt;/span&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>EDIT:
  I added the return false here and it works, but why? I am just returning false from the click event</p>
  
  <pre><code>else
              {
                  $('#mike').html(data2);
  
              }                   
          }
  
      });
       return false;
       });
  </code></pre>