W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>XMLHttpRequest 对象</h1> <p id="demo">让 AJAX 更改这段文本。</p> <button type="button" onclick="loadDoc()">更改内容</button> <script> function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.open("GET", "/demo/js/ajax_info.txt", false); xhttp.send(); document.getElementById("demo").innerHTML = xhttp.responseText; } </script> </body> </html>