$. GetJSON () accesses the time. php page, and the time. php page returns data.

Source: Internet
Author: User
$. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.