Skip to content Skip to sidebar Skip to footer

Pass Session Variable To The Ajax Called Php Script

While using the sessions in my PHP script I wanted to pass the session variable to the PHP called script. But the session variables are not being called as the session_start() func

Solution 1:

I think what you need is the following:

in your php-script you open/request with ajax, you have to add in the first line:

session_start(session_id());

This way, you have access to the variables you stored in your session where you called the request with ajax

Post a Comment for "Pass Session Variable To The Ajax Called Php Script"