anonymous
Drupal 7 check if user is logged in from javascript
Drupal 7 comes with jquery cookie plugin which can be find under
misc/jquery.cookie.js
This plugin can be used to check if user is logged in or not directly from Jquery. We do that by checking if the cookie DRUPAL_UID exists and its value is not equal to 0.