<!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", "/static/demo/txt/ajax_info.txt", false); xhttp.send(); document.getElementById("demo").innerHTML = xhttp.responseText; } </script> </body> </html>