I'm trying to find the best and cleaner way to execute a javascript function if a PHP session exists.
js-script.js
- contains javascript function -> function doStuff(){ //do stuff }
index.php
- contains js file -> in head
- contains PHP class that check for $_SESSION -> included before DOCTYPE
Please let me know thougts (I'm using PHP, javascript, jQuery).
- Best way to execute js script if $_SESSION exist?
- Best way to stop js script if $_SESSION is destroyed?
Thanks,
Greg