JavaScript-Ask about how to get the initialization data for a single page app!!!!

Source: Internet
Author: User
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.

  • 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.