Menu
Hi, my website checks if the user is logged in each time a page is loaded by checking a cookie which is placed.
My problem occurs when i make ajax calls to functions in the framework when the cookie has expired. The code that would usually redirect to the login page:
header(‘Location: /login’);
won’t work, i think because there is already html written to the page (i get a 302 error).
Is there anyway to be able to
try{header(‘Location: /login’);}
and then if that fails, just write a js <script>window.location=’/login’;</script> ??
Any help would be much appreciated.