1.代码展示
- <script>
- //获取元素
- const btns = document.querySelectorAll('button');
- let x = null;
-
- btns[0].onclick = function(){
- x = new XMLHttpRequest();
- x.open('GET','http://127.00.1:8000/delay');
- x.send();
- }
-
- //abort
- btns[1].onclick = function(){
- x.abort();
- }
- script>
2.结果截图
