AJAX technology relies heavily on XMLHttpRequest (XHR) DOM objects. It can construct HTTP requests, send them, and get the result of the request

Steps for Ajax native operations:

// 1. Create an object const XHR =new XMLHttpRequest(); // 2. Const url=""; To send the request to the server, we use the open() and send() methods of the XMLHttpRequest object: xhr.open("method","url") // 4. Xhr.send () xhr.send() xhr.send() Xhr.onreadystatechange =()=>{if(xhr.readyState==4&&xhr.status==200){ console.log("xhr.response"); }} nodejs // import module const XMLHttpRequest=require('xmlhttprequest-ssl'). // 1. Create an object const XHR =new XMLHttpRequest(); / / 2. The request url address const = 'http://192.168.1.24:8080/wx/category/list'; Initialize the request (to send the request to the server, we use the open() and send() methods of the XMLHttpRequest object: xhr.open("get",url); Xhr. send(null); / / 5. When the request is completed to perform XHR. The onload () = = > {the console. The log (' -- -- -- -- - > '+ XHR. The readyState); if(xhr.status==200){ console.log(xhr.responseText); }else{console.log(' Request error! '); }}Copy the code