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 isAjax
Asynchronous call orJs
Read areaHtml
Depends 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.