ES6使用fetch请求数据
ie是完全不支持fetch的。
fetch(url,{method:"get/post"}).then(res=>{ })
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。如果请求返回的status是200,body是ReadableStream那么,就要使用json()方法转换
例子:
fetch("http://jsonplaceholder.typicode.com/users").then(response => response.json()).then(res=>{
console.log(res);
})

更多精彩