📜  xmlhttp js 发布请求 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:15.941000             🧑  作者: Mango

代码示例1
var xhr = new XMLHttpRequest();
xhr.open("POST", '/url', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function() { // Call a function when the state changes.
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        // Request finished. Do processing here.
    }
}
xhr.send("name=Hello&id=world");