The pros and cons of Ajax

Source: Internet
Author: User


the advantages of Ajax
<1>: No refresh update data.
The biggest advantage of Ajax is the ability to communicate with the server to maintain data without refreshing the entire page. This enables the Web application to respond more quickly to user interactions and avoids sending information that is not changed on the network, reducing user latency and bringing a very good user experience.
<2>. Asynchronously communicates with the server.
Ajax uses asynchronous methods to communicate with the server, without interrupting the user's operations and having more rapid responsiveness. Optimize communication between browser and server, reduce unnecessary data transfer, time and reduce traffic on network.
<3>: Front-end and back-end load balancing.
Ajax can pass on some of the previous server workloads to the client, take advantage of the client's idle ability to handle, reduce server and bandwidth burden, save space and broadband rental costs. and reduce the burden of the server, the principle of Ajax is "on-demand data", can minimize the redundancy request and response to the burden on the server, improve site performance.
<4> standards-based is widely supported.
Ajax is based on standardized and widely supported technologies that do not require a browser plugin or applet to be downloaded, but require the client to allow JavaScript to be executed on the browser. With the maturation of Ajax, a number of libraries that simplify the use of Ajax have been introduced. Similarly, there is another assistive programming technique that provides alternative functionality for users who do not support JavaScript.
<5>: interface and application separation.
Ajax separates the interface in the Web from the application (or the separation of data and rendering), facilitates division of labor, reduces web application errors caused by non-technical changes to the page, improves efficiency, and is more applicable to today's publishing systems.

Disadvantages of Ajax
<1>. Ajax kills back and the history function, which is the destruction of the browser mechanism.
in the case of dynamically updating the page, the user cannot go back to the previous page state because the browser can only remember the static pages in the history. The difference between a fully read page and a page that has been dynamically modified is very subtle; The user will typically want to click the Back button to cancel their previous operation, but in an AJAX application this will not be possible.
The Back button is an important feature of a standard web site, but it does not work well with JS. This is a serious problem with Ajax, because users often want to be able to undo the previous operation by going backwards. So is there any way to do this question? The answer is yes, using Gmail know, Gmail under the Ajax technology to solve the problem, in Gmail can be back, but it does not change the mechanism of Ajax, it is only a relatively stupid but effective way, that is, the user click the Back button to access the history To reproduce the changes on the page by creating or using a hidden iframe. (for example, when a user clicks back in Google Maps, it searches in a hidden iframe and then reflects the search results on an AJAX element to restore the application state to its current state.) )
However, while this problem can be solved, the cost of development is very high and deviates from the rapid development required by the AJAX framework. This is a very serious problem caused by Ajax.
A related view is that using dynamic page updates makes it difficult for users to save a particular state to a collection. The solution for this problem has also occurred, with most of the URL fragment identifiers (often referred to as anchors, which are the parts of the # URL) to keep track of, allowing the user to return to the specified application state. (many browsers allow JavaScript to dynamically update the anchor point, which allows an AJAX application to update the anchor point while updating the display.) These solutions also address many of the arguments that do not support back buttons.
<2>. Security issues with Ajax.
Ajax technology provides users with a good user experience, but also brings new security threats to it enterprises, Ajax technology is like the enterprise data set up a direct channel. This allows developers to inadvertently expose more data and server logic than ever before. The logic of Ajax can be hidden from the client's security scanning technology, allowing hackers to create new attacks from remote servers. And Ajax also makes it difficult to avoid some known security weaknesses, such as cross-site footstep attacks, SQL injection attacks, and credentials-based security vulnerabilities.
<3> Support for search engines is weak.
support for search engines is weaker. If used improperly, Ajax can increase the flow of network data, thereby reducing the overall system performance.
<4>: The exception handling mechanism of the sabotage program.
at least for now, these Ajax frameworks, like Ajax.dll,ajaxpro.dll, can disrupt the program's exception mechanism. On this issue, had encountered in the development process, but looked at the internet there is little relevant introduction. Later, an experiment was done to delete a piece of data using Ajax and the traditional form submission mode ... It has brought us a lot of difficulties in debugging.
<5>: Violates the original intention of URL and resource location.
For example, I give you a URL address, if you use Ajax technology, perhaps you see below the URL address and what I see under this URL is different. This is contrary to the original intention of resource positioning.
<6>. Ajax does not support mobile devices very well.
some handheld devices (such as mobile phones, PDAs, etc.) are not yet well-supported Ajax, for example, when we open a website with Ajax technology on a mobile phone's browser, it is currently unsupported.
<7> client-side fat, too many client-side code causes development costs.
write complex, error-prone, redundant code is more (layer contains JS file is the common problem of Ajax, coupled with many of the previous service-side code is now placed on the client), destroying the original standards of the Web.

Ajax attention points and applicable and non-applicable scenarios
(1). Attention Point
when Ajax is developed, network latency-that is, the interval between a user sending a request to a server to make a response-requires careful consideration. Not giving users a clear response, without proper pre-reading data, or improper handling of XMLHttpRequest, will make users feel delayed, which users do not want to see, but they do not understand. A common solution is to use a visual component to tell the user that the system is in the background and is reading data and content.
(2). Ajax Application Scenarios
<1>. form-driven interactions
<2> The navigation of a deep tree
<3> Fast communication between users and users
<4>: Similar to voting, yes/no and other irrelevant scenes
<5> Scenarios for filtering and manipulating data
<6>: Normal text input hints and auto-complete scenes
(3). Ajax Not applicable scenarios
<1> Part of a simple form
<2> Search
<3> basic navigation
<4> Replace large amounts of text
<5> manipulation of the rendering

Reprinted from Sanmaospace's blog http://www.cnblogs.com/SanMaoSpace/archive/2013/06/15/3137180.html thanks to the great God

The pros and cons of Ajax

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.