tags: ajax
What exactly is Ajax?
ajax full name async javascript and XML (asynchronous JavaScript and XML)
It is the ability of front-end and back-end interaction, that is, the tool for our client to send messages to the server and the tool for receiving responses
AJAX is not a new programming language, but a new way to use existing standards.
AJAX is the art of exchanging data with the server and updating part of the web page without reloading the entire page.
It is a function of the default asynchronous execution mechanism. AJAX is divided into synchronous (async = false) and asynchronous (async = true)
What is a synchronization request? (false)
What is an asynchronous request? (Default: true)
Operating procedures:
1. Create an ajax object
const xhr = new XMLHttpRequest()
2. Configure link information

const xhr = new XMLHttpRequest()
// The open method in the xhr object is to configure the request information
// The first parameter is the request method of this request get / post / put / ...
// The second parameter is the url of this request
// The third parameter is whether the request is asynchronous or not, the default true means asynchronous, false means synchronous
// xhr.open('request mode','request address', is it asynchronous)
xhr.open('get', './data.php')
3. Send the request
//To send the request to the server, we use the open() and send() methods of the XMLHttpRequest object:
const xhr = new XMLHttpRequest()
xhr.open('get', './data.php')
// Use the send method in the xhr object to send the request
xhr.send()
const xhr = new XMLHttpRequest() xhr.open('get', './data.php')
xhr.send()
xhr.onreadyStateChange = function () {
// This event will be triggered every time the readyState changes
// We are here to determine whether the value of readyState is 4
// And is the status code of http 200 ~ 299
if (xhr.readyState === 4 && /^2\d{2|$/.test(xhr.status)) {
// This means that the verification passed
// We can get the content of the response from the server}
}
const xhr = new XMLHttpRequest()
// Add a? Directly after the address, and then pass it in the form of key=value // Two data are separated by &
xhr.open('get', './data.php?a=100&b=200')
xhr.send()
In this way, the server can receive two parameters, one is a, the value is 100, the other is b, the value is 200
const xhr = new XMLHttpRequest() xhr.open('post', './data.php')
// If you use an ajax object to send a post request, you must first set the content-type in the request header
// Tell the server what kind of data format I gave you xhr.setRequestHeader('content-type','application/x-www-form- urlencoded')
// When the request body is directly sent again, write it in ()
// No question mark is needed, just the form of'key=value&key=value' xhr.send('a=100&b=200')
// 1. Create ajax object
let xhr = new XMLHttpRequest()
// 2. Configure request information xhr.open(‘GET’, ‘./test.php’, true)
// 3. Send request xhr.send()
// 4. Accept the response xhr.onload = function () {
console.log(xhr.responseText) }
Work needs to search a lot of facial expression data on the Internet! This idea came into being! Baidu image search first, just like in waterfall mode Use inspection elements to find: Only the ...
Know the ckpt file of the model file, get the parameter names of the model through pywrap_tensorflow ...
Import C3P0 JAR package first C3P0UTIL.JAVA is placed under Util package C3P0-config.xml is placed in the src directory c3p0-config.xml C3P0Util.java...
Spring Boot The use of embedded containers, so its deployment method has become very simple and flexible, you can use Spring Boot Item packaging Stand alone Jar or War It can be shipped as a package o...
Scenes: Create a SSH Key: Open the ID_RSA.Pub file under the directory C: \ Users \ Lanfeiy.ssh, add the contents inside to gitlab, as shown below:...
Initialization block The strength initialization block is "illusion". After a class is compiled, the code block disappears and is restored to all the code of each constructor. Function: So t...
Spring version 5.0 xml configuration Note: The front-end WS protocol can request /websocket configured in the root directory of the project, and the path configured in the blue part of the code block ...
The CSS code is as follows: HTML code is as follows The JS code is as follows:...
Preamble: The company recently migrated data, do a test to verify the command. A, Hive section Two, HBase table ...
Preface Generally speaking, quick sort is an advanced insertion sort, but although many methods on the Internet are easy to understand, it is difficult to see the similarities with basic insertion sor...