In my website I set some values to session object like "user_status", "user_name" and like so. The php file looks like this:
<script type="text/javascript">
var logged = <? echo $this->session->getValueOf("user_status"); ?>;
</script>
<a class="show_message" href="#">SHow my status</a>
Well, I have a js script that pretends do an action according to user status
in the website, so, I have this:
$('.show_status').click(function(event){
//ask for user status
if (logged){
//do something
}
else{
//do another action for visitors
}
});
Walking around I thought if it is the best way flow data between session
-> javascript
, because if you inspect the page source at browser the value of user_status
will be visible and could be riskable for website security.
Thanks in advance
EDIT:
logged
var only takes a boolean value.- The js action must be executed each time the element
#(".show_status")
is clicked.