title: PHP header() doesnt redirects after ajax is called
body: <p>I am using ajax to insert data. after registration if successful it will redirect to its registry page or registry.php. But it seems that it is not redirecting to its respective page and the weird thing is when i check it on the console on firefox it seems that it gives a right result, something like this POST xxxx/form_zuri/insertData.php 302 Found
  50ms and GET xxxx/form_zuri/registry.php 302 Found 37ms. </p>
  
  <p>heres the code for insertData.php</p>
  
  <pre><code>    if($data = $admin-&gt;insertRegistrantInfo($fname, $lname, $aname, $email, $password) == true) {
      session_regenerate_id(true);// destroying the old session id and creating a new one
      $_SESSION['id'] =  $data;
      header('location: registry.php');
      exit();
  </code></pre>
  
  <p>heres my ajax script:</p>
  
  <pre><code>$("#submit_third").click(function(){
  
  
      $.ajax({
          type: "POST",
          url: "insertData.php",
          data: {
  
              fname                       : $("#fname").val(),
              lname                       : $("#lname").val(),
              aname                       : $("#aname").val(),                
              email                       : $("#email").val(),
              password                    : $("#password").val()              
  
              },
          cache: false,
          success: function(data) {
  
          //window.location.replace('registry.php') ;   
  
          }
      });
      //window.location.replace('registry.php') ;  
      //return false;
  
  });
  </code></pre>
  
  <p>if i will use the .replace js function it wont be able to get the SESSION ID.</p>
  
  <p>any idea guys?</p>