W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>XMLHttpRequest 对象</h1> <button type="button" onclick="loadDoc()">请求数据</button> <p id="demo"></p> <script> function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("demo").innerHTML = this.responseText; } }; xhttp.open("GET", "/demo/demo_get2.asp?fname=Bill&lname=Gates", true); xhttp.send(); } </script> </body> </html>