saifudeen ni saifudeen ni - 1 year ago 105
HTML Question

Get server time by using ajax

I want to get the server time in a variable. I am creating a count down timer, so that i need the server time. But i don't know how to take time and assign it into a variable (that variable will be used in JavaScript ). Please help me.

Answer Source

Depending on your needs and if your application already has server side code you can create a service on the server side that will provide the time. Then, from JavaScript you can make a call using Ajax or Web Sockets depending on what type of service you create to request the server time.

If your app doesn't have server side code and you don't want your particular server's time you can make an Ajax call to an existing Api such as .

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download