Forum Moderators: open
I have a script that simply refreshes the content of a certain div every few seconds using javascript.
My problem is that when a user, say, is logged out, the entire login page (with menu and all) displays within the contents of that div.
How can I programatically refresh the entire page, when needed? I tried the very basic top.location.href, but it doesn't work.
Any ideas would be greatly appreciated!
TIA!
Also, instead of your script returning a login page, perhaps you could have it return a javascript value (like "false") so you can branch based on that.
No cookies, no.
I think my best bet is to set a session value in PHP when the user is logged out. I can then check for this value in the application. I just need to know:
If it IS found, how can I make sure that I reload the full page, and not just the div that the chosen code may be updating?
In each call to refresh the div, a certain URL variable was passed. I then check that against the session value, and if it has changed, and the URL value exists, I don't display the header/footer. Just the box. If it doesn't exist, I display the whole page.
No JavaScript needed. : )
1) You have a web page
2) There is a DIV on that page that refreshes (let's say it's sports scores)
3) When logging in/out that DIV is being replaced with the page body?
Why not start/stop your timer when logging in/out?
If that's not what's going on, maybe your follow-up will help clarify what I am confused about.
You have the process correct. I couldn't stop the timer, because it also controls/updates other areas (divs) that don't require a user to be logged in.
My way prolly isn't the best way, but it's working now. It doesn't actuallu display a login box, just a message that you need to be logged in to see it. My problem was the message was including the full web page, instead of just the box. On other pages, I needed it to display the whole page (menu, navigation, etc).
So now I look to see if that particular URL variable is passed. If it is, I know I'm in a div, so just display the message. Otherwise, I display everything.
Clear as mud? : )