Beraki Beraki - 2 years ago 117
jQuery Question

How to check if a PHP session is set using jquery?

I have a php application that is working alongside jquery.
I want to check if the user session is still available in the js function.

If a session is set or if not return false.

Answer Source

Multiple ways, if the file is a .php ext. then:

var something = "<?php = $_SESSION['something'] ?>";

If you print the file after file_get_contents() use str_replace

You also can check cookie in javascript, seach for PHPSESSID

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download