What is the ajax

Ajax is asynchronous JavaScript and XML and it’s a technology that allows a web page to update data by exchanging data with the server without refreshing the page, and ajax is all over the web

How does Ajax work

An event occurs on the page -> create an XMLHttpRequerst() object —–> send a request to the server —-> the server receives the request internal processing request —–> the server sends us a response (data)—-> Receive the response to implement the page update. This process is the implementation of ajax workflow

Native Ajax request sent

This one has written a good interface use can directly (docs. Apipost. Cn/preview/f62…). In order to use Ajax to send requests, you must have a network

Let XHR = new XMLHttpRequest() // xhr.open(request method, URL address, async can omit default async)) // If GET request is used The data passed needs to be written after the URL in English state, okay? Combined with our parameters the interface document view XHR. Open XHR (' GET 'and' http://www.itcbc.com:3006/api/getbooks?appkey=13200008888 '). The send () specific see chart codeCopy the code

POST request mode

I’ll just write a screenshot of the code and show it