Introduction to Ajax technology and advantages and disadvantages

Source: Internet
Author: User

I recently learned about Ajax and consulted some Ajax materials online, mainly about Ajax technology and its advantages and disadvantages. Here, I want to make a small Summary of the information I have collected. Most of the information is from the internet. I will only make a Classification summary here, I hope it will be helpful to my friends who are learning Ajax just like me. First, let's take a look at the basic concepts of Ajax introduction Ajax represents Asynchronous JavaScript + XML. This technology was first introduced by Microsoft in 1999 and known for its "Remote Call of DHTML/JavaScript Web Applications. The basic idea of this technology is to allow an Internet browser to make asynchronous HTTP calls to a remote page/service, and update the current web page with the received results without refreshing the whole page. According to the opinion of the technology creator, this technology should be able to improve the client experience-making the HTTP page look and feel very similar to Windows desktop applications. Jesse James Garnett of Adaptive Path defines Ajax as follows: Ajax is not a technology. In fact, it is a combination of several booming technologies in a new and powerful way. Ajax includes:
  • Representation Based on XHTML and CSS standards;
  • Use Document Object Model for Dynamic Display and interaction;
  • Use XMLHttpRequest for asynchronous communication with the server;
How Ajax works
The core of AJAX is the JavaScript Object XMLHttpRequest. This object was first introduced in Internet Explorer 5. It is a technology that supports asynchronous requests. In short, XMLHttpRequest allows you to use JavaScript to request and process responses to the server without blocking users.
Specifically, Ajax is based on the following technologies:
XHTML: corresponds to the W3C XHTML specification. Currently, it is xhtml1.0.
CSS: corresponds to the W3C CSS specification. Currently, it is css2.0.
DOM: the Dom here mainly refers to the HTML Dom. The xml dom is included in the following XML
Javascript: ecmascript specifications corresponding to ECMA
XML: corresponds to W3C xml dom, XSLT, XPath, and other specifications.
XMLHttpRequest: corresponds to whatwg web applications1.0 specification (http://whatwg.org/specs/web-apps/current-work/) Next, let's take a look at the Ajax applicable scenarios and not applicable scenarios Ajax applicable scenarios
1. Form-driven Interaction
2. Deep tree navigation
3. fast communication and response between users
4. Irrelevant scenarios such as voting and yes/no
5. Data Filtering and data manipulation scenarios
6. common text input prompts and Automatic completion scenarios Ajax is not applicable scenarios
1. Some simple forms
2. Search
3. basic navigation
4. Replace a large amount of text
5. now, let's take a look at the advantages and disadvantages of Ajax. This is probably a new language that people are interested in learning Ajax, its advantages and disadvantages often determine its future destiny. As a new favorite of Ajax, its advantages and disadvantages must be the focus of attention. I will summarize the information collected from the Internet. Ajax advantages: 1. The biggest advantage is that the page is refreshing and communication with the server in the page gives the user a great experience.
2. Use asynchronous mode to communicate with the server, without interrupting user operations, so as to have a more rapid response capability. 3. Some of the previous server workload can be transferred to the client, and the client's idle capabilities can be used for processing. 4. Based on standardized and widely supported technologies, you do not need to download plug-ins or applets. The following is a formula for converting the proportion of bandwidth saved by Ajax compared with that by PAGE swiping:
(Interactions (page interaction traffic-Ajax Interaction Volume)-(added for the first time in Ajax)/(page interaction times + page size loaded for the first time)
There is a foreign experiment on AJAX technology: Using ajax to improve the bandwidth performance of Web Applications
① A 10 k page: Ajax technology, in the interaction, only part of the page needs to be updated 2-3 K data, the traditional full page refresh mode requires the whole page to be reloaded 10 K;
② The more interactions, the more obvious the bandwidth Saving Effect of Ajax applications;
③ Although the whole page is refreshed and images need to be re-loaded, Ajax does not need;
In this test, Ajax technology saved a total of more than 61%. It far exceeds the expected 50%, and the savings rate will be higher as interactions increase. The biggest highlight of AJAX is that the page is not refreshed. the asynchronous mode can reduce user waiting, and more functions can be implemented on the screen for more convenient interaction to improve customer experience, at the technical level, it can bring more flexible application structure organization. Disadvantages of Ajax: 1. A browser without a standard contention or a back or history Ajax cancels the back button, which destroys the browser's back-up mechanism. The back button is an important feature of a standard web site, but it cannot cooperate well with Js. This is a serious problem caused by Ajax. As a Web user, we are used to the back button, which is almost a common habit of every user. clicking a link under Ajax does not redirect the page, so there is no need to move back and forward, similarly, if you do not move back or forward, you will not find any browsing history records. The root cause of back and history is the URL change. In Ajax, people find that without modifying the URL, the content can also change this cool feature. If you have used Gmail, the Ajax technology used in Gmail can be used to solve this problem, but it cannot change the Ajax mechanism, it is only a stupid but effective method, that is, when you click the back button to access the history, you can create or use a hidden IFRAME to reproduce the changes on the page. However, although this problem can be solved, it brings about a very high development cost, which is different from the rapid development required by the Ajax framework. This is a very serious problem caused by Ajax. 2. Poor Support for search engines
3. Security issues the Ajax logic can hide the client's security scanning technology and allow hackers to create new attacks from remote servers. There are also known security vulnerabilities that cannot be avoided by Ajax, such as cross-site scripting attacks, SQL injection attacks, and credentials-based security vulnerabilities. 4. language problem I) complex compilation and error-prone (JavaScript is a lightweight little item that is forced to be reused now) ii) more redundant code (layer-by-layer inclusion of JS files is a common problem of Ajax, and a lot of the previous server code is now put on the client)
Iii) I have broken the original web standards. The above is my summary of Ajax knowledge, which may not be comprehensive. I hope to help my friends who want to learn Ajax together.

 

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.