title: Ajax window.location not working with PHP login Script
body: <p>I have a <code>PHP</code> login script which executes with ajax. The ajax request now starts the <code>session</code> in the login successfully but the <code>window.location</code> function doesn't work (doesn't redirect to <code>exporter.php</code>) in the ajax request. Below are my codes.</p>
  
  <p><strong>php Login Script</strong> </p>
  
  <pre><code>if(isset($_POST['log_name']) &amp;&amp; isset($_POST['log_password'])) {
  
      $username = $_POST['log_name'];
      $password = $_POST['log_password'];
  
      $sql = $db-&gt;prepare("SELECT * FROM users WHERE uname = ?");
      $sql-&gt;bindParam(1, $username, SQLITE3_TEXT);
  
      $ret = $sql-&gt;execute();
  
      while ($row = $ret-&gt;fetchArray(SQLITE3_ASSOC))
      {
          $id = $row['userid'];
          $regas = $row['regas'];
          $uemail = $row['uemail'];
          $pword = $row['pword'];
          $uname = $row['uname'];
          $package = $row['package'];
  
          if (password_verify($password, $pword))
          {
  
  
            $_SESSION['log_id'] = $id;
            $_SESSION['log_name'] = $username;
            $_SESSION['regas'] = $regas;
            $_SESSION['uemail'] = $uemail;
            $_SESSION['package'] = $package;
            //header("Location: index.php?log_id=$id");
            //echo "Sigining In...";
            //die("&lt;script&gt;window.location='exporter.php?userid={$id}';&lt;/script&gt;");
            exit();
          }
          else
          {
              echo "Information incorrect";
              exit();
          }
      }
  }
  </code></pre>
  
  <p><strong>Ajax Request</strong></p>
  
  <pre><code>$("#submit_log").click(function() {
        //e.preventDefault();
        username=$("#log_name").val();
        password=$("#log_password").val();
        $.ajax({
          type: "POST",
          url: "login.php",
          data: "log_name="+username+"&amp;log_password="+password,
          success: function(html){
            if(html=='true')    {
              window.location.assign = "exporter.php";
            }
            else {
              $(".logresult").html('Incorrect Username and Password');
            }
          },
          beforeSend:function()
          {
            $(".logresult").html("Loading...")
          }
        });
        return false;
      });
  </code></pre>
  
  <p><strong>Beginning part of exporter.php</strong></p>
  
  <pre><code>session_start();
  require_once ("db.php");
  $db = new MyDB();
  
  if (!isset($_SESSION['log_name']) || !isset($_SESSION['log_id']) || !isset($_SESSION['regas']))
  {
      header("Location: index.php");
  }
  </code></pre>
  
  <p>What could be wrong here and how do i fix this redirecting issue please!!!.Thanks.</p>