I have a javascript function that executes at page load, which is like this:
if (isTrue()) {
$.post("check.php", { value: 'true' } );
} else {
$.post("check.php", { value: 'false' } );
}
check.php looks like this:
if ($_POST['value'] == 'true') {
$_SESSION['value'] = true;
} else {
$_SESSION['value'] = false;
}
My problem is that if the function isTrue() is changed to return false, and I go to IE, I need to refresh the page twice to see that it was changed. If I set it to true again, same thing, when I refresh the first time changes are not there, when refreshing again, now they are.
What could be the cause of this odd thing?
Thanks for any input!
It’s because of the $_SESSION, $_SESSION[‘value’] is set but you don’t see that result until you refresh again, because the page was already loaded using the old value.