title: PHP header Location admin.php Not redirecting, but the page is downloaded
body: <p><img src="https://s24.postimg.org/uk4t5m90l/Sk_rmbillede_2015_04_24_kl_23_50_59.png" alt="console"></p>
  
  <p>im trying to redirect after a successful login, code as follows: </p>
  
  <pre><code>//if success (if there is a row)
  if ($result-&gt;num_rows &gt; 0) {
  $row = $result-&gt;fetch_assoc();    
  // make the server ready for a session
  session_start();
  $_SESSION['userId'] = $row['user_id'];
  $_SESSION['first_name'] = $row['first_name'];
  $_SESSION['user_role'] = $row['user_role'];
  $_SESSION['status'] = "ok";
  session_write_close();
  
  
  //get user_role for proper redirection
  $iUserRole = $row['user_role'];
  if($iUserRole==0){
  
  header('Location: ../admin.php');  
  exit();
  } else if($iUserRole==1){
  
    header('Location: ../user.php');
    exit();
  } else if($iUserRole==2){
  
    header('Location: ../partner.php');
  
    exit();
  }
  </code></pre>
  
  <p>i can see in the browser that the admin.php is downloaded.</p>
  
  <p>the php is called with:</p>
  
  <pre><code>$.ajax({
          url: 'ajax_api/login_auth.php',
          type: 'POST',
          data: {
              "sEmail": sEmail,
              "sPassword": sPassword
          },
      })
      .fail(function() {
          console.log("jquery ajax login_auth error");
      }).success(function(data) {
          console.log(data);
  
      });
  </code></pre>
  
  <p>and the console.log(data) logs the entire html page html/text.</p>