The deep thinking caused by Ajax application

Source: Internet
Author: User
Tags call back relative
Chinese people have a problem, love watching lively. Street quarrel must sweep on a glance at KO results.

A profession can change one's mind, and it involves the act of being a person. We are doing Java application development is also good this mouth. There's something new to try. Sometimes really not because of the need to apply, like to go to the street to see a person pk suddenly fresh. Ajax has been noisy recently so many Chinese are willing to defy the fight. Trying to fathom its secret. It's Fresh! But this passion often makes one forget the reason. Passion is to build on the basis of reason to play its maximum role. This thought, if forgotten, is a blunder.

In fact, you choose him if you do experiments or play a few small case can still, but also more people agree. This means that you are a man of exploration. Enterprising, is a talent. It's better than a lot of people who have nothing to do with it. And if the green Red has consistently applied to the real high user high concurrent volume of the system project, I am afraid it is unwise to represent personal opinion. Because I also refer to its role, the use of its strengths, the enemy people in the invisible. Grandson is a very powerful person why people study the art of war will not be outdated for many years. That is because he has grasped the nature of things. Just as we do the software application business prototype is the same as the system model. Because its stability is bound to last long, this is the truth. We want to let our projects not finally down to a large scale architecture-level refactoring, rather than choose to give up. Therefore, as far as possible before the decision should think of the cause and result, the best policy.

You want to see the lively, what drives you to see this lively. This requires analysis. If depending on the scene you find that the person who fights is your friend and relative. You are bound to participate in the event.

You want to use Ajax, what drives you to use it. We analyze. We don't use it for the sake of use. But in order to play its role. This is a meaningful activity if it is played into our business.

We design, where to apply. Can not blindly apply. Selective application to play its advantages, disadvantages of its shortcomings should be a good choice.

The following are the application design-time references:

"Guide" This paper describes the application of Ajax technology scenarios, AJAX scenarios and the specific situation of the application of some problems.

Ajax Application Scenarios

1. Form-driven interaction

Traditional form submission, after the text box input, click the button, the background processing finished, the page refresh, and then look back to check whether the refresh result is correct. Using AJAX, after clicking on the Sunmit button, immediately asynchronous processing, and on the page quickly show the results of the update, there is no overall page refresh problem.

2. Deep-rooted tree navigation

The Deep cascading menu (tree) traversal is a very complex task, using JavaScript to control the display logic, using AJAX to delay loading deeper data can effectively reduce the burden on the server.

Most of our previous processing of cascading menus is this:

In order to avoid the overloaded pages that are caused by each operation on the menu, instead of using each call back to the background, all the data for the cascading menu is read out and written to the array, and then the rendering of the subset item is controlled by JavaScript according to the user's action, which solves the response speed, Do not overload the page and avoid sending requests frequently to the server. However, if the user does not operate the menu or only a part of the menu, the read data will become redundant data and waste the user's resources, especially in the context of complex menu structure, the large amount of data (such as the menu has many levels , every level of food and hundreds of projects), this abuse is more prominent.

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

When we initialize the page, we only read all the data from its first level and show that when a user operates one of the first-level menus, all data for the level Two submenu to which the current level of the project belongs is requested by Ajax to the back desk, and if you continue to request an item from the level two menu that is already rendered, And then to request all the data of all level three menus for the two-level menu item that you are working on, and so on ... In this way, take what you use, take as much as you can, there will be no data redundancy and waste, reduce the total number of data downloads, and update the page without overloading the entire content, only update the part that needs to be updated, relative to the background processing and overloading of the way to shorten the user waiting time, but also to minimize the waste of resources.

3. Fast communication between users and users

The most frustrating thing about being involved in the conversation is to have the user refresh the page over and over again to see if there is a new discussion. New responses should be displayed as quickly as possible, and Ajax is the best choice to free users from distracting refreshes.

4. Similar to voting, yes/no and other innocuous scenes

In a scenario like this, if the commit process needs to reach 40 seconds, many users will simply ignore the past and not participate, but Ajax can control the time within 1 seconds, so that more users will join in.

5. The scene of filtering and manipulating relevant data for data

Use filters for data, sorted by time, or sorted by time and name, switch filters, and so on. Any situation requiring highly interactive data manipulation should be done using JavaScript, rather than a series of server requests. After each data update, it takes more time to find and process it, and Ajax can speed up the process.

6. Normal text input prompts and automatic completion of the scene

Typing prompts in input forms such as text boxes, or automating them, can be an effective way to improve the user experience, especially if the automatically completed data may come from a server-side situation, Ajax is a good choice.

Ajax does not apply to scenarios

1. Some simple forms

Although form submission can get the most benefit from Ajax, a simple comment form rarely gets any noticeable improvement from Ajax. While some of the less-used forms are submitted, Ajax is not a helpful one.

2. Search

Some AJAX-enabled search engines such as start.com and live.com are not allowed to use the browser's Back button to view the results of a previous search, which is inexcusable for users who have developed search habits.

Now dojo solves the problem with an IFRAME.

3. Basic navigation

Using AJAX to do navigation within a site is a bad idea, why not put time on the system to make it better?

4. Replace a large amount of text

Use Ajax to achieve local refresh of the page, but if each part of the page changes, why not make a server request again?

5. Manipulation of the presentation

Ajax looks like a pure UI technique, but it's actually not. It is actually a technique for data synchronization, manipulation, and transmission. For a clean, maintainable Web application, it's a good idea not to use Ajax to control page rendering. JavaScript can be very simple to deal with Xhmtl/html/dom, using CSS rules can be very good expression of data display.

The problems that exist

1. JavaScript ajax engine, JavaScript compatibility and debug is a headache;

2.Ajax No refresh overload, because the page changes without refreshing the overload so obvious, so easy to bring trouble to users? D? D users are not sure whether the current data is new or have been updated; the existing solutions are: in the relevant location hints, data updates of the area design is more obvious, the data updated to user prompts, etc.;

3. The intermediate process cannot be bookmark. WORKAROUND: GoogleMaps by providing a "link to this page" solution on the pages. In addition, you can also resolve it by adding an invalid? ^ tag to the URL link, but it has not yet been validated. I think there's a boss in the IBM developer Forum who doesn't remember the name. It is a good choice to use the existing mature presentation layer framework of Java EE. The need to use will not give yourself a lot of broken bridges. Just try may have a bitter fruit waiting, temptation, stimulation, lead you to lose your sanity.

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.