Ajax-17:使用fetch函数发送ajax请求 Always_positive 2021-04-08 78 阅读1分钟 基础用法 btn.onclick = function() { fetch('http://localhost:8000/fetch',{ // 请求方法 method: 'POST', // 请求头 headers: { name: 'justin' }, // 请求体 body: { username: 'jusitn', password: 123456 } }).then(value => {console.log(value);}) }