维科纳蒂 »
×
改变方向
在 Codepen 上打开
更改主题,深色/浅色
<!DOCTYPE html> <html> <body> <h2>Об’єкт XMLHttpRequest</h2> <button type="button" onclick="loadDoc()">Запит даних</button> <p id="demo"></p> <script> function loadDoc() { const xhttp = new XMLHttpRequest(); xhttp.onload = function() { document.getElementById("demo").innerHTML = this.responseText; } xhttp.open("POST", "demo_post2.asp"); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("fname=Henry&lname=Ford"); } </script> </body> </html>