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)