I'm not sure if I labelled my title correctly, but I was told that the code below wouldn't work because the browser window never reloads upon submission of the form that updates content (it is inside a shadowbox).
<?php
if(isset($_SESSION['contentupdated'])) {
unset($_SESSION['contentupdated']);
echo 'window.location.reload();';
}
?>
How would I write PHP code based on the above code that "polls" the site to see if the variable $_SESSION['contentupdated']
is set? Below, I will paste my full shadowbox code that I was attempting to use as well. The updated code will replace the PHP code within the JavaScript code. That way upon closing the shadowbox, the website will poll the site to see if there is an updated code (that is my goal at least).
I was told I'd have to poll the site to check for updates but I have searched Google and can't find a solution for this as all the results come up as "How to create a website poll".
<script>
Shadowbox.init({
onOpen: onShOpen,
onClose: onShClose,
});
function onShOpen() {
document.body.style.overflow = "hidden";
return true;
}
function onShClose() {
document.body.style.overflow = "auto";
<?php
if(isset($_SESSION['contentupdated'])) {
unset($_SESSION['contentupdated']);
echo 'window.location.reload();';
}
?>
return true;
}
</script>
Any suggestions?