📜  xmlhttprequest 发布表单 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:49.512000             🧑  作者: Mango

代码示例1
var data = new FormData();
data.append('user', 'person');
data.append('pwd', 'password');
data.append('organization', 'place');
data.append('requiredkey', 'key');

var xhr = new XMLHttpRequest();
xhr.open('POST', 'somewhere', true);
xhr.onload = function () {
    // do something to response
    console.log(this.responseText);
};
xhr.send(data);