$. GetJSON () accesses the time. php page. the time. php page returns the data 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 problem 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 ()));
?>
Is this the case for moderators? But there is still no result. is the returned json format incorrect? please advise
Time. php page
Echo json_encode (array ('time' => time ()));
Still no result. my time. php page:
Echo json_encode (array ('time' => time ()));
?>
Time. php page
Echo json_encode (array ('time' => time ()));
Still no result. my time. php page:
Echo json_encode (array ('time' => time ()));
?>
Try alert (data. time) to see what the result is?
Time. php page
Echo json_encode (array ('time' => time ()));
Still no result. my time. php page:
Echo json_encode (array ('time' => time ()));
?>
Try alert (data. time) to see what the result is?
No response
You can enable the browser debugging function to check whether the request has been successfully sent.