Chrome 控制台模拟POST

var url = "http://*****/app/invited/invited/personlist";
var params = {phone: "",orderkey: "time",ordermethod: "desc",page: 0,pagesize:60};
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = function (e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
console.log(xhr.responseText);
} else {
console.error(xhr.statusText);
}
}
};
xhr.onerror = function (e) {
console.error(xhr.statusText);
};
xhr.send(JSON.stringify(params));

 

posted @ 2020-12-01 17:42  懒人境界  阅读(1620)  评论(0编辑  收藏  举报