title: How to redirect page after the jquery ajax is call?
body: <p>This is my Login form code.  My problem is after the statement is true. Is will not be redirect to the home page instead it's just show the home page at my index page. </p>
  
  <p>How to Redirect jquery ajax at the other page after the statement is true?</p>
  
  <p>HTML Code   </p>
  
  <pre><code>&lt;form id="myForm" class="form-group" method="post" action="actions/login_check.php"&gt;    
      &lt;div id="result"&gt;&lt;/div&gt; 
      &lt;table class="table-condensed" &gt;
          &lt;tr&gt;&lt;br&gt;
            &lt;td&gt;&lt;input type="text" name="username" class="form-control" autofocus="autofocus" placeholder="Username" size="40"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type="password" name="password" placeholder="Password" class="form-control"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;button id="submit" class="btn btn-primary form-control"&gt;Sign In&lt;/button&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td align="right" style="font-size:14px;"&gt;&lt;a href="forgot_password.php"&gt;Forgot Password?&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP code</p>
  
  <pre><code>$username = mysqli_real_escape_string($con,$_POST['username']);
  $password = mysqli_real_escape_string($con,sha1($_POST['password']));
  $empty = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
  
  $query = mysqli_query($con,"SELECT * FROM users WHERE username = '".$username."' AND password = '".$password."'");
  $row = mysqli_num_rows($query);
  $getUser = mysqli_fetch_array($query);
  
  
  if(empty($username) or $password == $empty)
      echo "Invalid Email or Password";
  elseif($username == $getUser['username'] and $password ==  $getUser['password']){
      session_start();
      $_SESSION['username'] = $username;
      $online = "UPDATE users SET active = 1 WHERE username = '".$username."'";
      mysqli_query($con,$online);
      header("Location: ../home.php");
      $_SESSION['timestamp'] = time();
  }else
      echo "Invalid Email or Password";
  </code></pre>
  
  <p>jQuery Ajax</p>
  
  <pre><code>    $("button#submit").click(function(){
  
      if( $("#username").val == "" || $("#password").val == "")
          $("div#result").html("Please enter username and password");
      else
          $.post( $("#myForm").attr("action"),
              $("#myForm :input").serializeArray(),
              function(data) {
                  $("div#result").html(data);
              }
           );
  
           $("#myForm").submit(function(){
              return false;
           });
  });
  </code></pre>