Ajax (Ajax) asynchronous request data

js file:

1. Accept data, split and splicing processing

2.var xhr = XMLHTTPRequest()

3. Determine the request type, get or post; there are parameters in the url of get, but not in the post (can not be directly seen by the user); write xhr.open(); Write xhr.setRequestHeader().

4. Judging that the readystate has changed to 4, indicating that the request data is over; if it is judged that it is successfully returned (200), the output //The idea of ​​detecting readystate here is asynchronous.

Handwritten stickers:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325320685&siteId=291194637