Index.htm page:
function UpdateTime () {
$.getjson ("time.php",
function (data) {
alert (data);
now = Data.time;
}
);
}
time.php page:
{"Time": 1454237138}//Returns a time, 1454237138 indicates the number of seconds
Now my question is: {"Time": 1454237138} needs to return the current time instead of returning a fixed time.
Reply to discussion (solution)
time.php page
echo json_encode (Array (' time ' = Time ()));
time.php page:
echo json_encode (Array (' time ' = Time ()));
?>
Moderator, is that so? But there is no result, is not the return JSON format is not correct, please advise
time.php page
echo json_encode (Array (' time ' = Time ()));
Still no results, my time.php page:
echo json_encode (Array (' time ' = Time ()));
?>
time.php page
echo json_encode (Array (' time ' = Time ()));
Still no results, my time.php page:
echo json_encode (Array (' time ' = Time ()));
?>
You try alert (data.time) and see what happens?
time.php page
echo json_encode (Array (' time ' = Time ()));
Still no results, my time.php page:
echo json_encode (Array (' time ' = Time ()));
?>
You try alert (data.time) and see what happens?
No reaction.
You can open the browser debugging function to see if the sent request has been successfully