How do you get the initialization data for a typical single-page application?
是后台把数据插到模板中,然后Js从html结构中读取?还是页面打开时调用ajax异步从数据库获取所需要的数据然后插到页面?
Reply content:
How do you get the initialization data for a typical single-page application?
是后台把数据插到模板中,然后Js从html结构中读取?还是页面打开时调用ajax异步从数据库获取所需要的数据然后插到页面?
Must be mixed use ... The original HTML was sent in the background, usually embedded in a little bit of data, and then Ajax was acquired.
Pro, more hands to improve, I think you recently asked the quality of the problem is not high.
I understand that you want to learn from the experience of others, but the experience of others
1-not necessarily suitable for your ideas
2-not necessarily suitable for your needs
3-not necessarily suitable for your problem
Have a nice weekend
Thank you for inviting me. Still depends on your own needs, whether it's an ajax asynchronous call or a js read html -out or a business need.
HTML is a static page with only a few dom containers. JS through the Ajax way with the background service interaction, background services with the database interaction, query and return the page load the required data, the front-end to obtain data, processed and then rendered to the page.