Is it possible to create and update a session variable in JavaScript? Just like in PHP as I start sessions and initialize session variable.
I\'m using some JavaScrip
Well, taking a look at how sessions work, no, they cannot be created with javascript. You can, though, make an AJAX request to your PHP file to set one.
PHP:
JS:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "session_maker.php", true);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
alert("Done! Session created.");
}
};