Note that there are some explanatory texts on larger screens.

plurals
  1. PO'window.location.replace' redirects to the given page but destroies the session from php (Chrome only)?
    primarykey
    data
    text
    <p>I know that the question is a bit confusing but here is the case.</p> <p>I have the following Ajax function:</p> <pre><code> $.ajax({ url:"../controllers/xx_register.php", type:"POST", data:send, success: function(response){ if (response=="1") { window.location.replace("http://localhost/Underground/01.InProgress/ES-dictionary/public/index.php"); return true; } else{ $('#error').append(response); } }, error: function(){ $('#error').append('Fatal error!'); } }); return false; </code></pre> <p>the xx_register.php file:</p> <pre><code>$arr=$_POST; $reg = registerMe($arr); if ($reg === true) { $_SESSION['is_logged']=$arr['username']; echo 1; exit(); } else{ echo($reg); exit(); } </code></pre> <p>finally the index.php</p> <pre><code> session_start(); if (isset($_SESSION['is_logged'])) { header("Location: ../views/start.php"); exit(); } else{ header("Location: ../views/login.php"); exit(); } </code></pre> <p><strong>Shortly - the idea:</strong> I use ajax function for registering a new users. If everything is ok with the registration the user will be redirected to <code>index.php</code>. As the <code>$_SESSION['is_logged']</code> exist the user will be redirected to the <code>start.php</code> page.</p> <p>This all works for FireFox 21, IE 10, Safari 5.1 but on Chrome 27 the thing are quite different - the user is again redirected to <code>loggin.php</code>. The simple logic is pointing that <code>window.location.replace</code> is redirecting to <code>index.php</code> and clearing the session. I really don't see any explanation. Two questions: 1. Am I correct about the issue with the <code>window.location.replace</code>? 2. How to fix it?</p> <p>Thanks a lot.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload