Static page call PHP get data re-format display

Source: Internet
Author: User
We now have some PHP code that calls the relevant interface to return the JSON data. Now I want to implement PHP in HTML and output the returned data to HTML. Do you think this is realistic? (Note that the PHP section simply returns the JSON data, rather than writing something like document.write)

For example, the PHP interface will return a JSON data, I want the HTML to display a table to display the content.

I'm a client developer, and I know a little bit about the fur of the front. This is done because the original browser to open the server to do some of the pages, but a few pages of the performance is particularly bad and no one can tune (said to use a very advanced framework), so I now come up with the whole method.


Reply to discussion (solution)

The page to be executed must be the end of. PHP to parse PHP, and the logic to execute PHP should be wrapped up
After obtaining the JSON data, Json_decode ($json, True); An array that can be printed out to see
Embed the value of the array where you want it to appear, such as:

Get the data through Ajax and embed it in the page.

Use Ajax to call the PHP interface where you return the JSON data, and then use JS to parse the JSON to display on the page

Use Ajax to call the PHP interface where you return the JSON data, and then use JS to parse the JSON to display on the page

A simple example, see below.

 
  ' Fdipzone ', ' gender ' = ' male '),    Array (' name ' = ' Tom ', ' gender ' = ' male '),    Array (' name ' = ' Lucy '), ' Gender ' = ' female '); >   
 
             

Thank you, you don't have to use this method at the end.
If you use the page, the special front-end developers to debug, I myself or from the client technology to find a way.

  • 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.