I would like to grab the time (something like): 16:08 from the server - and display it on the website real time. (Like, each minute do the update, and display the new time.
I'm not sure however, what wou开发者_JS百科ld be a good way for accomplish this nor if there is any nice plugin that I should be aware of. :D
Can I have some insights about the possibilities here?
I'm using PHP and I can use Jquery as library.
Thanks a lot, MEM
Use Javascript and set a timer for every minute. Have the timer call a function that uses Ajax to call the correct page on the time server which gets the time and then have the Javascript replace the existing time.
You could also just get the actual time from the server when you load the page, then use Javascript to increment the minute/hour section appropriately by using a timer that 'ticks' every minute.
If the problem is just to display the time you can use Date.getTime() javascript function. But if you want to get the time from the server and display it to the client you can use an ajax request using JQuery.
精彩评论