您可以尝试使用 XMLHttpRequest, 如下所示。
<!DOCTYPE html><html><body><h2>The XMLHttpRequest Object</h2><button type="button" onclick="loadDoc()">Request data</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("POST", "cookies.php", true); xhttp.send();}</script></body></html>
演示: https
:
//www.w3schools.com/js/tryit.asp?filename=tryjs_ajax_first
参考: https :
//www.w3schools.com/js/js_ajax_http_send.asp
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)