how to get the server date with Jquery

Asked

Viewed 1,684 times

2

I am trying to get the server date, I know that to get the server date with php, more will be possible with Jquery?

  • makes an ajax for a php file that returns the server data

  • Do you want to get the date of a specific server? Or do you just want to ensure the correct date? Since you can get the date also from a web service.

2 answers

4


Only with Jquery it is not possible to get the server date. Since Jquery is a javascript framework where it runs only in the user’s browser.

  • it has in the server-side the PHP

  • @Sneepsninja Yes he has php on the server, but the question was: How to get the date using only with Jquery.

  • Thank you for the reply Jahnkrauss.

  • hum...ok, but still your answer is not 100% correct because it induces AP to think that javascript is prevented from doing this task and Nodejs would solve the problem by staying all in javascript

-1

It is possible so, put this code in javascript on the page:

var variavelDataJquery = "<?=date('d/m/Y H:i:s');?>";

  • this way the date that this picking is the client computer not of the server

  • No, it’s not friend... If you repair the function date PHP returns the server date.

  • um... truth ta ali a tag <? php, only this way mischaracterized the first AP that wants to do this in javascript, but it is a 50% javascript and 50% php response

  • kkkk, it is true...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.