Front-end and server-side (routing)

Source: Internet
Author: User

Routing (front-end): Principle: Only a few XHR requests, you can implement the page flicker-free change URL

Front:
1. Ajax assumes data communication and relative logic (interactive logic)

Ajax interacts with the URL to make the changes in the data interaction reflect the changes in the URL.
Allows users to save URL links and restore previous content (including changes to Ajax local refreshes)

Server side:
1. Assume most of the business logic
2. Processing requests from the browser, according to the different URL routing, stitching out the corresponding view page,
Return to browser for parsing rendering via HTTP (hard back-end responsibility)
3. Core Logic
4. Database

By recording a URL to record the changes in Ajax on the Web page palette, we can call it Ajax tagging .
For larger frameworks, we call them routing systems , such as AngularJs .


HTML5 New History API

Window.history.pushState (data, title, URL); Add a record to the browser history stack
Window.history.replaceState (data, title, URL); Replace the current record in the history stack

Example:
Window.history.pushState (null, NULL, ' current URL address ' + '? Name=lqc '); Implement no refresh change URL address bar
Window.history.pushState (null, NULL, '/name/liuqiuchen ');
Error occurs if a non-current address is written: Due to cross-domain generation error

Angularjs Making Simple Routing features demo
Http://www.jb51.net/article/64045.htm

Front-end and server-side (routing)

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.