创建请求对象

  1. const request = new XMLHttpRequest()

开启请求

  1. request.open("请求类型", "请求地址", true)

发送请求

  1. request.send()

监听响应

  1. request.onreadystatechange = () => {}

响应状态

  1. request.readyState

获取响应状态码

  1. request.status

获取响应状态字符串

  1. request.statusText

获取所有响应头

  1. request.getAllResponseHeaders

获取响应体

  1. request.response