Axios 库
• 地址:https://unpkg.com/axios/dist/axios.min.js
• 使用 script 标签引入
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
// 体会 get 请求
axios.get("http://localhost:3000/db")
.then(function (response) {
console.log(response.data)
})
.catch(function (error) {
console.log(error)
})
axios.get("http://localhost:3000/users")
.then(function (response) {
console.log(response.data)
})
.catch(function (error) {
console.log(error)
})
</script>