jquery - PHP get real time date without page reload -


i have code gets server date , time in php works well. need work time rather on page load...

code below:

<?php if(date('w') !== 0) {   if((current_time('hi')<1800 && current_time('hi')>=1400) || (current_time('hi')<1300 && current_time('hi')>=700)) {     echo 'we open';   }   else {     echo 'we closed';   } } else if(intval(current_time('hi'))<1230 && current_time('hi')>=700) {   echo 'we open'; } else {   echo 'we closed'; } ?>     <p>we close @ <strong>  <?php if (date('l') != "sunday") {     echo '18:00'; } else if (date('l') == "sunday") {     echo '12:30'; } ?>  </strong> today</p> 

is possible make work poll server / work after page loads - example, if on monday page loaded @ 17:58 , user views page 3 minutes, code should change sign showing open closed without need page refresh.

will need abandon route , use jquery instead?

appreciate insight.

cheers

you need create new php file in server return current time , using ajax need make xhr request php file have created in server


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -