AJAX使用XHR 对象和服务器进行数据交互
XHR
<p class="my-p"></p>
<script>
const xhr = new XMLHttpRequest()
xhr.open(`GET`,`http://hmajax.itheima.net/api/province`)
xhr.addEventListener(`loadend`,()=>{
// console.log(xhr.response)
const data = JSON.parse(xhr.response)
const myp = document.querySelector(`.my-p`)
myp.innerHTML = data.list.join(`<br>`)
})
xhr.send()
</script>