Keeping dynamic data in webpage

Hi there.

Please help in keeping dynamic data (or keep changing data) like variations of stock prices in the webpage made by using HTML.
All of your suggestions are welcome.


There are two general approaches to this.

  1. The dynamics is on the server side so that each time the page is requested, the server provides the most recent data from the database in the response document.
  2. The page requests periodic updates from the server using AJAX at timed intervals.

Thank you very much, Sir.

Sir, may I ask you one more question on this? Sorry for keep asking but I can see you are the frequent poster and definitely expertise in this subject… Hope you don’t mind.

About your first approach how can we implement dynamic server side in our code (i believe there are two approaches from the solution you have provided 1. when user wants updated data at his/her own will and 2. when user already implemented some time period in code to find updated data using AJAX command).

Sir, can you provide some example scripts (or link to that) for both the solutions where this kind of scenario has already been implemented?


I’m afraid my expertise is limited in this area from lack of practice or application. You will need to do some digging online for reliable examples.

A server-side approach would involve PHP and mySQL. The user could update the page simply by refreshing it.

The client side approach would take signals from the user and respond accordingly. One such signal could be a change in a form control field. or a button click, or a click in a page element, or some such event. The event handler would then assemble a request and send it via XHR to the server, and then handle the response from the server to update the page. This is not a page refresh, though. Just a dynamic change to the DOM.

Thank you once again, Sir.

This will be of great help to me. I really appreciate your positive and prompt response.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.