Home > Article > Backend Development > javascript - Please tell me how to obtain the initialization data of a single-page application! ! ! !
How is the initialization data of a general single-page application obtained?
<code>是后台把数据插到模板中,然后Js从html结构中读取? 还是页面打开时调用ajax异步从数据库获取所需要的数据然后插到页面?</code>
How is the initialization data of a general single-page application obtained?
<code>是后台把数据插到模板中,然后Js从html结构中读取? 还是页面打开时调用ajax异步从数据库获取所需要的数据然后插到页面?</code>
It must be a mixed use... The initial Html is sent from the background, usually a little bit of data is embedded, and then ajax is used to obtain it.
Dear, you can improve by doing more. I think the questions you asked recently are not of high quality.
I understand that you want to learn from other people’s experiences, but other people’s experiences
1- may not be suitable for your ideas
2- may not be suitable for your needs
3- may not be suitable for your problems
Happy weekend
Thanks for the invitation. It still depends on your own needs, whether it is ajax
asynchronous call or js
reading areahtml
it still depends on your business needs
html is a static page with only some DOM containers. js interacts with the backend service through ajax, and the backend service interacts with the database to query and return the data required for page loading. The front end obtains the data, processes it, and then renders it into the page.