title: Jquery - Form doesn't submit
body: <p>I'm trying to submit my form through Jquery, but the submit part of my code just doesn't work! And I can't see what's wrong with it.</p>
  
  <pre><code>&lt;?php
      if(!isset($_SESSION["useridentity"])){
          die(header("Location:index.php"));
      }
      include("actions/connect.php");
      $q = "SELECT username FROM users WHERE useridentity = '".$_SESSION["useridentity"]."'";
      $r = mysql_query($q,$con);
      $f = mysql_fetch_array($r);
  ?&gt;
  &lt;div class="absolutedialog" id="login"&gt;
      &lt;form class="loginform" id="loginform" name="loginform" method="POST" action="actions/login.php"&gt;
          &lt;div class="label"&gt;
              Welcome back, &lt;b&gt;&lt;?php echo $f["username"]; ?&gt;&lt;/b&gt;. Please, type your password to confirm your identity.
          &lt;/div&gt;
          &lt;input class="loginformpassword" id="password" type="password" name="pass" maxlength="32"/&gt;
          &lt;div id="passwordfail"&gt;&lt;/div&gt;
          &lt;input class="regularbutton" id="submit" type="button" value="Submit"/&gt;
          &lt;button class="grayregularbutton" id="gobacktoconsole" type="button"&gt;Go back&lt;/button&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;div class="blackoverlay"&gt;&lt;/div&gt;
  
  &lt;script&gt;
      $(document).ready(function() {
          $('#login').fadeIn(1000);
          $('.blackoverlay').fadeIn(500);
  
          //Destroy $_SESSION variables and go back to console
          $('#gobacktoconsole').on('click',this, function(e) {
              $(".absolutedialog").fadeOut(500);
              $(".blackoverlay").fadeOut(1000);
              window.setTimeout(  
                  function() {  
                      window.location.href="actions/logout.php";
                  },
                  1000
              );
          });
  
          //Submit validations
          $('#submit').on('click',this, function(e){
  
              if($("#password").val() == "")
                  $("#passwordfail").html("Please, type your password");
              else{
                  $("form#loginform").submit();
                  $(".absolutedialog").fadeOut(500);
                  $(".blackoverlay").fadeOut(1000);
              }
  
          });
  
          //Clear password message error when something is typed in the password input
          $('#password').on('keyup',this, function(e) {
              $("#passwordfail").html("");
          });
  
          //Prevent default submit on enter, and click #submit button instead in order to execute validations
          $('#loginform').bind("keyup keypress", function(e) {
              var code = e.keyCode || e.which; 
              if(code  == 13){
                  e.preventDefault();
                  $("#submit").click();
  
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried adding <code>return false;</code> below <code>$("form#loginform").submit();</code> but doesn't works. Am I missing something? Please, help!</p>
  
  <p>Sorry for the lack of details; if you need me to add some more, please ask.</p>