Home > php教程 > PHP开发 > body text

Understand AJAX, understand the advantages, disadvantages and applications of AJAX

黄舟
Release: 2016-12-15 09:42:18
Original
1170 people have browsed it

This article will give you a brief introduction to AJAX, understand the advantages, disadvantages and how to use AJAX.

A brief introduction to AJAX

AJAX technology began to be applied to the Web around 1998, and was later promoted through Google, allowing more people to understand the original JavaScript It can be used in this way, instead of the stereotyped impression of advertising text display or screen gradient in the past. Nowadays, AJAX is no longer a new term or new technology, but the most classic and famous representative works are Google Suggest and Google Maps.

 Definition of AJAX

 AJAX stands for "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), which is a web development technology for creating interactive web applications.

  AJAX vs. Traditional

 The traditional approach to JavaScript is that your files or databases come from the server or are sent to the server. You can use an HTML form and use GET or POST to send the data through the submit button. Go to the server and wait for the response message. But using AJAX, you can use JavaScript's XMLHttpRequest object to communicate with the server, and you can directly update all or part of the page through the data responded from the server.

 Advantages of AJAX

 a. It is not necessary to update the entire web page, but some pages can be updated.

  b. Optimize the communication between browser and server, reduce unnecessary data transmission, time and data traffic on the network.

  c. Balances the load on the front and back ends. Originally, most of the data is processed by the back end. AJAX allows the client to share some of the work, reducing the load on the back end.

 Disadvantages of AJAX

 a. Browser versatility, each user's browser is different and the version is inconsistent, which may cause inoperability problems.

  b. The client will be too fat, and too much program code on the client will also cause development costs.

  c. The server may be exposed and may be maliciously attacked and tampered with, causing security vulnerabilities.

  Application of AJAX

Why is AJAX suitable for loading operations? Traditional web page data updates mostly send the data back to the client-side browser after the server-side data is updated. When the browser gets an update request, it will update the web page. Content updated. After the user executes the loading operation, the status message of the job has not yet been returned. If the next job is performed at this time, the status message will often be lost. Precisely because the loading system also needs to control the front-end cement loading, once the status of the equipment changes, the content of the web page must be updated in a timely manner so that the embedded object in the web page can maintain communication with multiple hardware devices. Taking into account that multiple hardware operations will not interfere with each other, using Ajax can make the entire operation process smoother and more reasonable.

 For example: when the user wants to load cement and presses the load button, if JavaScript is used to call the com component of the client, the loading may need to wait for a period of time, causing the entire webpage to crash, and also affecting other buttons. Invalid. At this time, if you use AJAX technology as an aid, each action of AJAX will use XML Http Request to communicate with the server. After the server responds, it will receive the response data and update the Model status, database and web page, so that the user does not have to wait all the time. The actual loading time will not cause the page buttons to become invalid.

 The application of AJAX is not only used in cement loading, but is also used in other functions and systems. Considering the actual usage of the entire system, AJAX solves the problem of data delay and improves the speed of data transmission, allowing each operating base to provide faster services.

The above is to understand AJAX, understand the advantages, disadvantages and applications of AJAX. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template