weird behavior with redirecting if the user is not logged-in
<p>I have a two <code>setInterval(myFunction,40000)</code> and  <code>setInterval(myFunction2,50000)</code>  where myFunction and myFunction2 are making ajax requests and if the user is not logged-in</p>

<pre><code>echo '&lt;meta http-equiv="refresh" content="0;url='.$home.'" /&gt;';
echo '&lt;script type="text/javascript"&gt; self.location = "'.$home.'"; &lt;/script&gt;';
exit(); 
</code></pre>

<p>In the ajax respons there is :</p>

<pre><code>&lt;meta http-equiv="refresh" content="0;url=http://site.com/login" /&gt;
&lt;script type="text/javascript"&gt; self.location = "http://site.com/login"; &lt;/script&gt;
</code></pre>

<p>but the page is not changing and after 6 requests is changing.</p>

<p>The ajax</p>

<pre><code>$.ajax({
type:"POST",
url:"http://site.com/thing.php",
data:submitData,
dataType:"html",
success:function(data){someDiv.html(data);}
});
</code></pre>

<p>in thing.php</p>

<pre><code>&lt;?php

if(is_logged()){
-- the code
} 

else {
 -- the redirect code
}
?&gt;
</code></pre>

<p>?></p>

<p>And the code is working but after the 6 request </p>
