I am trying to pass the value userSession(id of the user)
to the javascript. But i can't seem to pass the session id to var master
. I am a new to javascript here
$(document).ready(function(){
$('#token-btn').hide();
infoBox.onDisplay = function(ln){
var master = "<?php echo $_SESSION['userSession']; ?>";
if(ln.id == master)
$('#token-btn')[0].style.display = "none";
else
$('#token-btn')[0].style.display = "";
};
});
main.php
<?php
$id = $_SESSION['userSession'];
?>
<li><a id="token-btn" href="#" type="button" class="btn btn-primary"> Give Invitation Token</a> </li>