Welcome Guest, Not a member yet? Register   Sign In
AutoRefresh
#1

[eluser]Unknown[/eluser]
Hi,

sorry for my English. I have a little problem. Is there a way how to refresh page (controller) automatically? For example: I developed an application, which is used more then 20 people together. Someone insert new item to Database (MySQL). And I need to refresh page for everyone after this insert. Is there any way how to do it?

I have idea how to do it. Automatically refresh using javascript every "X" minutes. Or another solution using AJAX and check through another function in controller if there is any change in database. But it's periodical check and I would like to refresh page immediately after change DB.

Is there another solution ?

Thank you for your responses and any help.
#2

[eluser]jedd[/eluser]
[quote author="Onthera" date="1249325557"]
Automatically refresh using javascript every "X" minutes. [/quote]

You wouldn't use JS for that - just a simple pragma refresh.

Quote: But it's periodical check and I would like to refresh page immediately after change DB.

Then you definitely need to JS it.

But remember, both methods may be annoying for users, especially if they are in the middle of something - a text-copy, editing a field, or just reading the content, etc.

I'd go for a little notifier that reports if there is new information the user may be interested in, and offer them a link to refresh the page. This requires JS, of course, so it's out of my skillset.
#3

[eluser]garymardell[/eluser]
If you want everyones to update immediately without periodical checks then you will have to look into using comet for it. This is how say facebook chat works. However you could just make a periodic updater every 3 seconds or something that will check for new content and if there is new content receive it and use javascript to update the page. You don't need to actually refresh the whole page. If you are going to use javascript for the update then use javascript to replace (or append) content.
#4

[eluser]Unknown[/eluser]
Thank you for you replies. I hope that there is another solutions. But it seems that there is only one way... I think that the best way will by notification for users, that there is new entry.

Thank you for you responses again.

Have a nice day




Theme © iAndrew 2016 - Forum software by © MyBB