原生ajax代码
[HTML]
- <!DOCTYPE html><html>
- <body>
- <h1>XMLHttpRequest 对象</h1>
- <p id="demo">让 AJAX 更改这段文本。</p>
- <button type="button">更改内容</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>