I have a login area of my site, and on login I set a session variable $_SESSION['logged_in'] = true
.
Now I also have lots of forms and things where users can input comments. Obviously in my PHP validation I check the user is logged in simply using the session variable, but I want javascript validation too because I can make the user experience slicker that way.
$("body").on("click", ".submit", function(e){
e.preventDefault();
if (user == logged in){
...AJAX call to php file....
}
})
So how do people generally do the bit where I check the user is logged in using javascript?
ie
if user == logged in