Home >Web Front-end >Front-end Q&A >what is the use of ajax
The functions of ajax are: 1. Update the web page without refreshing the page; 2. Request data from the server after the page is loaded; 3. Receive data from the server after the page is loaded; 4. Send to the server in the background data.
The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
What is the use of ajax?
Update the web page without refreshing the page
After the page is loaded Request data from the server
Receive data from the server after the page loads
Send data to the server in the background
What is AJAX?
AJAX = Asynchronous JavaScript And XML.
AJAX is not a programming language.
AJAX only combines:
The browser’s built-in XMLHttpRequest object (requesting data from the web server)
JavaScript and HTML DOM (display or consume data)
Ajax is a misleading name. Ajax applications might use XML to transfer data, but it's just as common to transfer data as plain text or JSON text.
Ajax allows web pages to be updated asynchronously by exchanging data with the web server behind the scene. This means that portions of a web page can be updated without reloading the entire page.
How AJAX works
1. An event occurs in the web page (page load, button click)
2. Create an XMLHttpRequest object from JavaScript
3. The XMLHttpRequest object sends a request to the web server
4. The server processes the request
5. The server sends the response back to the web page
6. Read the response by JavaScript
7. Perform the correct action by JavaScript (such as updating the page)
Recommended learning: "ajax video tutorial"
The above is the detailed content of what is the use of ajax. For more information, please follow other related articles on the PHP Chinese website!