function testAvatar() {
var data = {
"username": "123123",
"password": "123"
}
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
var i = JSON.parse(this.responseText);
}
}
xmlHttp.open('POST', 'http://localhost:8080/account/login', true);
xmlHttp.setRequestHeader('Content-Type', 'application/json')
xmlHttp.send(JSON.stringify(data))
}
如果没该Request请求头则会报415错误
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)