I really don’t know what you mean by jQuery “reloads”, because usually you use JQuery so you don’t have the page reloading:
Example:
Here the jQuery script ->
[code]$(function() {
/* The Countdown Timer to call the Ajax Method */
var updateTime = setInterval(displayTime, 1000);
/* The Ajax Method of Getting Time */
function displayTime() {
var $clock = $('.clock');
$.ajax({ // Start of ajax:
url: 'sendCountDown.02.php', // Pulling time from the server:
dataType: "json", // Format type:
success: function(info) { // Grab the data from php and then display it:
// Variables * Self-Explanatory *
var days = info.countDown.days, // Grab total days till expiration:
hours = info.countDown.h, // Grab total hours till expiration:
minutes = info.countDown.i, // Grab total mins till expiration:
seconds = info.countDown.s, // Grab total secs till expiration:
$msg = '';
if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 10) {
seconds = '0' + seconds;
}
$msg = days + ' Days ' + hours + ' Hours ' +
minutes + ' Minutes ' + seconds + ' Seconds';
/* Display Time in Message */
$clock.text($msg);
},
error: function (response) {
var r = jQuery.parseJSON(response.responseText);
alert("Message: " + r.Message);
alert("StackTrace: " + r.StackTrace);
alert("ExceptionType: " + r.ExceptionType);
}
}); // End of ajax call:
} // End of Function:
}); // END OF DOC READY:[/code]
An here’s the PHP script->
[php]<?php
date_default_timezone_set(‘America/Detroit’); // Set the Default Time Zone:
session_start();
$future = (isset($_SESSION[‘future’])) ? $_SESSION[‘future’] : ‘2014-07-04 00:00:00’;
$expired = new DateTime($future);
$now = new DateTime();
$e[‘countDown’] = $now->diff($expired, true);
print json_encode($e); // JSON
[/php]
The jQuery manipulates the date that is sent via the server (PHP), not the other way around.