Sessions are stored server-side, so you cannot add values to them from JavaScript. On the client side you can only get the session cookie, which contains an id. One possibility is to send an AJAX request to a server-side script, which will set the session variables. Here is an example using jQuery's .post() method:
Sessions are stored server-side, so you cannot add values to them from JavaScript. On the client side you can only get the session cookie, which contains an id. One possibility is to send an AJAX request to a server-side script, which will set the session variables. Here is an example using jQuery's
.post()
method:Of course, you should be careful about exposing such scripts.
In JavaScript:
In the session_write.php file:
In HTML: