# 使用Axios串接API (4) ###### tags: `JavaScript` 2022.2.28 ## 套件取用(CDN) ``` <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> ``` ## 實作(抓取網站資料) ``` axios.get('https://randomuser.me/api') //抓取網站數據 .then(res =>{ console.log(res.data.info); }) //如果抓不到資料,傳遞錯誤訊息 .catch(err =>{ console.log(err); }) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up