unknown123 Posted November 9, 2008 Share Posted November 9, 2008 Hi I got some numbers in my database and i want to use a time stamp to display each number every 10 seconds to the browser. This is for a online cricket management I am making and all the scores have already been calculated and stored in the database and I need to display a ball every 10 seconds to make it look like the game is actually being played live. 1) How would i go about doing this? 2) Other better ways of making this happen or is time stamp the best way to acheive this? Thanks in advance Quote Link to comment Share on other sites More sharing options...
POG1 Posted November 9, 2008 Share Posted November 9, 2008 Re: Time Stamp ajax maybe? Quote Link to comment Share on other sites More sharing options...
Floydian Posted November 9, 2008 Share Posted November 9, 2008 Re: Time Stamp The simple answer is you need to have the user's browser request a page every ten seconds. Anything the user sees or does all begins with them. In order to get something to the user every ten seconds, they have to request it every ten seconds. Normally, this is achieved using a javascript timeout loop. Here's a link to a page that shows how to set up such a loop. -> http://www.w3schools.com/js/js_timing.asp Now, there's basically three ways to exploit this. Have the loop refresh the entire page, refresh and iframe/frame, or load an ajax request. Quote Link to comment Share on other sites More sharing options...
Zeggy Posted November 11, 2008 Share Posted November 11, 2008 Re: Time Stamp You probably want to use the setInterval javascript function, use ajax to fetch a page for results and append that to a div. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.