#ajax5个步骤
//(1).实例化ajax对象
let xhr = new XMLHttpRequest()
//(2).设置请求方法和地址
xhr.open(“post”, “https://autumnfish.cn/api/user/register”)
//(3).设置请求头(post请求才需要设置)
xhr.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”)
//(4).发送请求 : 参数格式 ‘key=value’
xhr.send(“username=admin”)
//(5).注册回调函数
xhr.onload = function() {
console.log(xhr.responseText)
}
#深拷贝