. 1 <Script> 2 window.addEventListener ( 'Load', function (EV) { . 3 var BTN = document.getElementById ( 'Send' ); . 4 btn.addEventListener ( 'the Click', function (EV1) { . 5 // . 1. Create a request object . 6 var XHR = new new the XMLHttpRequest (); . 7 . 8 // 2. ready to send . 9 xhr.open ( 'GET', 'HTTP: // localhost: 3000 / API / One', to true ); 10 . 11 / / 3 transmits a request 12 is xhr.send (); 13 is 14 //4. The response server monitor 15 xhr.addEventListener ( 'the readystatechange', function (EV2) { 16 // the console.log (xhr.readyState); . 17 IF (xhr.readyState ===. 4 ) { 18 is // means that the server in response to the end of a 19 @ response does not mean that the secondary weapon is necessarily correct 20 is // the console.log (xhr.status); 21 is IF (=== 200 is xhr.status ) { 22 is the console.log (xhr.response); 23 is the console.log (xhr.responseText); 24 } 25 } 26 is }); 27 }); 28 }); 29 </script>