I have a very simple timeoftheserver.php page:
<?php
echo date('D, d M y H:i:s');
?>
and on my local script is also simple:
var today;
try {
today = new Date($.ajax({'type': 'HEAD', 'url': 'timeoftheserver.php'}).getResponseHeader('Date'));
}
catch(err) {
today = new Date();
alert("here");
}
alert(today);
but instead of the server time (or even the local time and the alert here
) I got the popup:
Thu Jan 01 1970 01:00:00 GMT+0100 (Central Europe Standard Time)
What's wrong with this code?