Analysis of AJAX application scenarios

Source: Internet
Author: User

Ajax application scenarios

1. Form-driven Interaction

For traditional form submission, after entering the content in the text box, click the button. After the background processing is complete, the page is refreshed, and then check whether the refresh result is correct. With Ajax, after clicking the "sunmit" button, asynchronous processing is performed immediately, and the updated results are displayed quickly on the page. There is no problem with refreshing the entire page.

2. Deep tree navigation

In-depth cascading menu (tree) traversal is a very complex task. using JavaScript to control the display logic, loading deeper data with Ajax latency can effectively reduce the burden on the server.

Most of the previously processed cascading menus are as follows:

To avoid page overloading caused by each menu operation, instead of calling the background every time, all the data in the cascading menu is read at one time and written into the array, then, you can use JavaScript to control the presentation of its subset projects based on your operations. This solves the problem of operation response speed, no page overloading, and frequent requests sent to the server, however, if you do not operate the menu or only operate a part of the menu, a part of the read data will become redundant data and waste your resources, especially when the menu structure is complex and the data volume is large (for example, the menu has many levels and each level of food has hundreds of projects), this disadvantage is even more prominent.

If Ajax is applied in this case, the results will change:

On the initialization page, we only read and display all the data of the first level, ajax is used to send a request to the background for all the data in the level-2 sub-menu of the current level-1 project. If you continue to request an item in the level-2 menu that has been displayed, then, request all data of all level-3 menus corresponding to the level-2 menu items to be operated, and so on ...... In this way, there will be no data redundancy and waste, reducing the total amount of data downloads, and you do not need to reload all content when updating the page, only the part to be updated can be updated. Compared with the background processing and reload method, the user wait time is shortened and the resource waste is minimized.

3. fast communication and response between users

When many people participate in the discussion, the most unpleasant thing is to let the user refresh the page over and over again to know if there is any new discussion. New replies should be shown as quickly as possible, and Ajax is the best choice to free users from the refreshing of distraction.

4. Irrelevant scenarios such as voting and yes/no

In a scenario like this, if the submission process takes 40 seconds, many users will ignore the past and will not participate, but AJAX can control the time within 1 second, so that more users will join in.

5. Data Filtering and data manipulation scenarios

Use filters for data, sort by time, or sort by time and name, and switch filters. Javascript should be used for any scenario requiring highly interactive data manipulation, rather than a series of server requests. After each data update, it takes a lot of time to search for and process the data. Ajax can accelerate this process.

6. common text input prompts and Automatic completion scenarios

In the text box and other input forms, the input prompt or automatic completion can effectively improve the user experience, especially when the automatically completed data may come from the server, Ajax is a good choice.

Ajax not applicable scenarios

1. Some simple forms

Although form submission can get the greatest benefit from Ajax, a simple comment form rarely gets significant improvements from Ajax. Ajax is not helpful for some forms that are rarely used.

2. Search

Some search engines that use Ajax, such as start.com and live.com, do not allow the browser's back button to view the results of the previous search. This is intolerable for users who have developed the search habit.

Now, Dojo uses IFRAME to solve this problem.

3. basic navigation

It is a bad idea to use Ajax for site navigation. Why don't we put the time on making system programs better?

4. Replace a large amount of text

AJAX can be used to partially refresh the page. But if every part of the page changes, why not re-create a server request?

5. Rendering operations

Ajax looks like a pure UI technology, but in fact it is not. It is actually a technology for data synchronization, manipulation, and transmission. It is a good idea to not use ajax to control page rendering for maintainable and clean web applications. Javascript can easily process xhmtl/html/DOM, and use CSS rules to express data presentation.

Problems

1. The javascript-based Ajax engine makes JavaScript compatibility and debugging a headache;

2. Why is the refreshing and reloading of Ajax easy to disturb users because the page changes are not as obvious as refreshing and reloading? D? D. the user does not know whether the current data is new or updated. The existing solutions include: the relevant location prompts, data update areas are designed to be obvious, and user prompts are given after the data is updated;

3. The intermediate process cannot be bookmark. Solution: googlemaps provides a "link to this page" solution on the page. In addition, you can add invalid? ^ Mark, but not verified.

Note: The above content comes from the Internet and I am not liable for any joint liability.

Article transferred from: http://tech.51cto.com/art/200603/23960.htm

Related Article

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.