Thoughts on AJAX applications

Source: Internet
Author: User
The profession can change people's thinking, and by the way, it involves people's behavior. This is exactly what we need to develop Java applications. You have to try it out for any new things. Sometimes it is not really necessary to apply the application, just like going to the street to see people's PK suddenly fresh. Ajax has been a hot topic recently, so many Chinese people are willing to set an example. Try to understand its mysteries. Fresh! But such passion often makes people forget their minds. Passion is based on reason before it can play its biggest role. It would be a big mistake to forget this idea.

In fact, if you choose to experiment on your own or play with a few small cases, it is quite acceptable. This shows that you are an explorer. Be enterprising and be a talent. It is much better than mixing without any problems. However, I am afraid it is unwise to apply it to real high-user and high-concurrency system projects, which only represents my personal opinions. Because I also refer to its role, use its strengths, and kill the enemy. Sun Tzu is a very powerful man. Why can't people study the art of war fall behind for years. It is because he has grasped the essence of things. Just like building a system model for a software application business prototype. This is the truth because its stability must last for a long time. We want to keep our projects from being finalized to a wide range of architecture-level reconstruction, so we should give up. Therefore, we should try our best to consider the cause and effect before making a decision.

You want to see the excitement. What drives you to see the excitement. This requires analysis. If you find that the target person is a friend or relative. You must participate in this activity.

You need to use Ajax. Our analysis. We are not using it for use. It is used to play its role. This is a meaningful activity if we use it to our business.

We designed and applied it somewhere. Applications cannot be used blindly. The advantages and disadvantages of selective applications should be good choices.

The following are references for Application Design:

[Introduction] This article briefly describes the application scenarios of Ajax technology, the specific situations of Ajax inapplicable scenarios, and some problems existing in the application.

  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 request all data in the level-2 sub-menu of the current level-1 project to the background. If you continue to request an item in the level-2 menu that has already 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 display.

  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. I think there is a boss in the IBM Developer Forum who doesn't remember what the name is. It's a good choice to use it with the mature performance Layer framework of J2EE. If you use it as needed, you will not be able to cut yourself off. A blind attempt may result in waiting, temptation, stimulation, and guiding you to lose your mind.

There is something wrong with the Chinese. When the street quarrel, you must take a look at Ko's results.
 

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.