I am currently doing some tests using the following code:
function updateCurrentTime() {
var HeaderDate;
$.ajax('/', {
url: "http://www.google.com",
type: 'HEAD',
success: function(r,status,xhr) {
HeaderDate = xhr.getResponseHeader('Date');
}
});
var curTime = new Date(HeaderDate);
}
Unfortunately at the following line:
var curTime = new Date(HeaderDate);
I am not able to retrieve the variable content of the HeaderDate in the AJAX code.
The goal is to get time from a different location than the local computer running the script.
I even tried using global variables without any success.
Can you help me out please?
Thanks a lot for your time and help.