I am using Javascript's setInterval method to keep on updating the time of the Client computer. This is my code:
$(document).ready(function() {
setInterval(function() { setCookieForDate(); }, 500);
});
function setCookieForDate() {
var cookie_date = new Date();
var serverDateTime = '<%=DateTime.Now%>';
document.cookie = "LocalDate=" + cookie_date.toLocaleString() + "|" + serverDateTime;
}
Problem is that sometimes i still get stale (old) value.
when the value is being retrieved, it retrieves the old value even if when I check the cookie value it shows the UPDATED value.
Can any one suggest me any kind of modification in this code?