谷歌浏览器发送POST请求

在谷歌浏览器控制台执行以下代码:
谷歌浏览器发送POST请求_第1张图片
var url = “/actuator/refresh”;
var params = {advertiserUid: 1232131, advertiserWeiboNickname: “18”};
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));

可以看到post请求成功
谷歌浏览器发送POST请求_第2张图片

你可能感兴趣的:(谷歌浏览器发送POST请求)