I am having requirement in my project that I need to READ A SESSION VARIABLE WITH JQUERY and the session variable is created using PHP. How can I achieve this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t access session variables directly from jQuery: Sessions run on the server; JavaScript runs on the client.
You’d have to export the variables from PHP to JavaScript, e.g. like so:
Be careful to export only session variables that are not security relevant.