views:

1281

answers:

7

I have a web page which allows the user to carry out various operations that in turn modify the database. Also, this web application needs to keep track of various fields in database that keep changing with time. Is refreshing the page every few seconds the best possible way to implement this? For example, if there is a long list on the page requiring scrolling, it is hard to view the list since the page keeps resetting due to the refresh. I know, there are ways to retain the position of the scroll. But, could I use something more efficient?

+2  A: 

Short answer is NO. YOu can use ajax to update the necessary components. This reduces the load time and keeps your page from resetting.

Milhous
+1  A: 

AJAX with a Timer

Matthew
A: 

That sounds like a functionality that would be better suited in a Flash or Silverlight application. Using an elaborate AJAX solution might be a bit more efficient than your but the reality is that web pages make a terrible medium for live content.

Spencer Ruport
web pages make a great medium for live content. comet, ajax, etc.
mainsocial
+1  A: 

Without going into too much detail, in general you might want to consider generating your HTML dynamically, using Javascript, in an Ajax-style manner. It's considerably more challenging to do right, but it's the right way to go from a user-experience perspective.

Check out the Yahoo user-interface library for guidance and assistance -- it does make things a good deal easier than trying to do everything by hand.

Christian Nunciato
+4  A: 

Use AJAX with timer.Using this we can refresh the particular part in the page.

BlackPanther
+2  A: 

I think you need something similar to Reverse AJAX now popularly known as Comet. It is server pushing the data to the client instead of browser polling the data from the server/database. http://en.wikipedia.org/wiki/Comet_(programming) has a good introduction. There are already many frameworks (e.g. DWR, ICEFaces) that support this pattern.

royalGhost
A: 

This may be helpful: http://codeshode.blogspot.com/2010/06/auto-refresh-web-page.html

tjaank