Check PHP session with jQuery
Is there a way to check to see if a user currently has a session in PHP with jQuery? I'm trying to say if there isn't a session then I'd like to pop open a login box which I can do but just don't know how to check the session. Thanks.
Last edited by Kor; 03-15-2011 at 02:19 PM.
Agreed, I would want to use the jQuery to use the .load function and call my PHP script to display the login box if there is no PHP session variable present.
You can query a php script using AJAX that tells you whether the session has expired periodically and then load the form if the session is no longer valid. My recommendation is to use JSON in your returns from php since you could combine both calls into a single response.
$resultsArray['status'] = false;
$resultsArray['form'] = "html form for login here";
$resultsArray['status'] = true;
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)