let xhr = new XMLHttpRequest() xhr.open('POST', 'http://xx.aa.cn/home/moban/ssds11') xhr.setRequestHeader('Content-Type', 'application/json') xhr.send( JSON.stringify({ username: 'alex' }) ); xhr.onreadystatechange = function () { if (xhr.readyState === 4 || xhr.status === 200) { console.log(xhr.responseText); } }
content-type 不能修改传输数据类型 只能声明一下而已
标签:aa,传输数据,js,content,xhr,type From: https://www.cnblogs.com/newmiracle/p/17030982.html