Home >Web Front-end >JS Tutorial >[Interview Question] Summarize the principles, advantages and disadvantages of Ajax

[Interview Question] Summarize the principles, advantages and disadvantages of Ajax

coldplay.xixi
coldplay.xixiforward
2020-07-31 13:09:523095browse

[Interview Question] Summarize the principles, advantages and disadvantages of Ajax

##[Interview question] Summarize the principles, advantages and disadvantages of Ajax

The principle of Ajax


The principle of Ajax is simply to send an asynchronous request to the server through the XmlHttpRequest object, obtain data from the server, and then use JavaScript to operate the dom to update the page. The most critical step in this is to obtain the request data from the server.

XmlHttpRequest is the core mechanism of Ajax. It was first introduced in IE5 and is a technology that supports asynchronous requests. Simply put, JavaScript can make requests to the server and process responses in a timely manner without blocking the user, achieving a no-refresh effect.

The benefits Ajax brings to us

The biggest point is that the page does not refresh and communicates with the server within the page, giving the user a very good experience.

Using asynchronous mode to communicate with the server, there is no need to interrupt the user's operation, and it has a faster response capability.

You can transfer some of the work previously burdened by the server to the client, using the idle capacity of the client to process it, reducing the burden on the server and broadband, and saving space and broadband rental costs. And to reduce the burden on the server, the principle of Ajax is to "fetch data on demand", which can minimize the burden on the server caused by redundant requests and responses.

Disadvantages of Ajax

The shortcomings of Ajax described below are all caused by its innate nature.

Ajax kills the back button, which destroys the browser's back mechanism. The back button is an important feature of a standard web site, but it doesn't work well with JavaScript. This is a serious problem caused by Ajax.

Security issues

Technology also brings new security threats to IT companies. Ajax technology is like establishing a direct channel. This allows developers to inadvertently expose more data and server logic than before. Ajax logic can be hidden from client-side security scanning technologies, allowing hackers to create new attacks from remote servers. There are also some known security weaknesses in Ajax that are difficult to solve, such as cross-site scripting attacks, SQL injection attacks and credentials-based security vulnerabilities.

[Topic recommendation]:

2020 ajax interview questions and answers (latest)

The above is the detailed content of [Interview Question] Summarize the principles, advantages and disadvantages of Ajax. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete

Related articles

See more