[Front-end foundation] ajax

 

 

What is ajax?

ajax-asynchronous JavaScript and xml: asynchronous js and xml

It can use js to access the server, and it is asynchronous access

The response from the server to the client is generally an entire page, a complete html page! But in ajax because it is a partial refresh, then the server does not need to respond to the entire page, but only the data.

 

Asynchronous interaction and synchronous interaction

Synchronization: To send a request, wait for the server's response to end before sending the second request. The middle period of time is what we often call "card". The entire page is refreshed.

Asynchronous: Send a request without waiting for a response from the server, and then you can send a second request. You can use js to receive the server's response, and then use js to refresh locally.

 

Ajax advantages:

1. Increased user experience: The biggest advantage of Ajax is that it can maintain communication with the server without refreshing the entire page

2. Asynchronous communication with the server: use asynchronous communication with the server, without interrupting the user's operation

3. Front-end and back-end load balancing: move some back-end work to the front-end to reduce the burden on servers and bandwidth

4. Widely supported based on specifications: no need to download browser plug-ins or small programs, but the client needs to allow JavaScript to be executed on the browser.

5. Separation of interface and application: Ajax makes the interface and application separate, that is, the separation of data and presentation

 

Ajax disadvantages:

1. Ajax kills the Back and History functions, which destroys the browser mechanism

2. Security issues: AJAX technology brings a good user experience to users, but also brings new security threats to IT companies. Ajax technology is like establishing a direct channel to corporate data. This allows developers to inadvertently expose more data and server logic than before.

3. Weak support for search engines

4. Destruction of the program's exception handling mechanism

5. Violating the original intention of URL and resource positioning

6. Cannot support mobile devices well

 

Front-end free course: Alibaba Cloud University-Developer Class

Guess you like

Origin blog.csdn.net/weixin_40050195/article/details/96153385