If I understand it right, you want to read some value stored in session (in php stored in $_SESSION
) as a client from javascript.
First: session is server-side thing, clients don’t know that they are in session.
But there is a way, how to send value.
This is what came to my mind:
<h2 id="titlesystem"></h2>
<p id="bodysystem"></p>
<input type="hidden" value=<?php echo $_SESSION["value"]?> id="mySessionValue">
<script>
var sessionValue = document.getElementById("mySessionValue").value;
if (sessionValue == 1)
{
document.getElementById("titlesystem").innerHTML = "Your System";
document.getElementById("bodysystem").innerHTML = "Amazing!"
}
</script>