Javascript-how to obtain the initialization data of a single-page application !!!!

Source: Internet
Author: User
How do I obtain the initialization data of a single-page application? {Code...}: how does one obtain the initialization data of a single-page application?

Is the background inserting data into the template and then Js reading from the html structure? Or can I call ajax to asynchronously obtain the required data from the database when the page is opened and insert it to the page?

Reply content:

How do I obtain the initialization data of a single-page application?

Is the background inserting data into the template and then Js reading from the html structure? Or can I call ajax to asynchronously obtain the required data from the database when the page is opened and insert it to the page?

The first Html is sent from the background, usually embedded with a little bit of data, and then obtained by ajax.
I think the quality of your recent questions is not high.
I understand that you want to learn others' experiences, but others' experiences
1-not necessarily suitable for your ideas
2-not necessarily suitable for your needs
3-not necessarily suitable for your problem

Have a good weekend

Thank you for your invitation. It depends on your own needs, whether it isAjaxAsynchronous call orJsRead areaHtmlDepends on your business needs

Html is a static page with only some DOM containers. Js interacts with the background service through ajax. the background service interacts with the database, queries and returns the data required for loading the page. the front-end obtains the data and renders it to the page after processing.

Related Article

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.