Hi everyone.
I would like to implement a counter using ajax that will act like this:
The script will send a XMLHttpRequest every x seconds which will return a value from a mysql database.
Using the current and previous value retrieved from the server, the script will increase the counter, in order to reach the new value in the x second interval between the server requests.
The value will be decimal (two decimal digits are enough), it will always icrease (until it resets) and my main concern is to make it increase with variable speed, to give a more interesting visual effect. Meaning that if the (current value - previous value) is big the counter will speed up to "catch up".
I already have code that reads a value from a database and just prints it to a html div element every x seconds.
So i would like a suggestion on the counter increase algorithm.
Hope i made it clear... :)
Thanks in advance.