Home  >  Article  >  Backend Development  >  javascript - Please tell me how to obtain the initialization data of a single-page application! ! ! !

javascript - Please tell me how to obtain the initialization data of a single-page application! ! ! !

WBOY
WBOYOriginal
2016-07-06 13:51:421005browse

How is the initialization data of a general single-page application obtained?

<code>是后台把数据插到模板中,然后Js从html结构中读取?
还是页面打开时调用ajax异步从数据库获取所需要的数据然后插到页面?</code>

Reply content:

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 ajaxasynchronous call or jsreading 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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn