What is Ajax?

Ajax is a programming model popularized by Google in 2005. Ajax is technically a technology rather than a language. It can update the local data of the page without refreshing the page, so as to reduce the waiting time of users when browsing information and optimize the user experience.

(Forward + attention, private reply “lebyte” can get more free materials to receive!)

Step 1: Create the request (get the Ajax object)

Step 2: Make connections

Step 3: Send the request

* Request mode:

① GET: pass the url as a parameter

② POST: The request header needs to be created. Otherwise, no data can be received

* Request file: this is the file used to receive data. PHP files are used as an example

* Request method:

① True: asynchronous request (mainstream request method)

② false: Synchronous request (hardly used)

Step 4: Receive response data Ajax status code:

① If the status code is 0, the request is not initialized

② If the status code is 1, the request is established

③ If the status code is 2, the request is received

④ If the status code is 3, the request is being processed

⑤ Status code is 4:

Request completed and ready HTTP status code:

(1) If the status code is 200, the request is successfully completed

② If the status code is 404, the page is not found

③ If the status code is 403, access is denied

Let’s demonstrate the steps of an asynchronous request in code

Share core programming techniques, V: Lezijie009 or Lezijie520 (code 21 no remarks cannot pass oh ~)

(Forward + attention, private reply “lebyte” can get more free materials to receive!)