<button onclick="switch1()">axios请求</button>
function switch1()
{
axios.get("https://www.autumnfish.cn/api/joke/list?num=6").then(function (response){console.log(response)})
}
请问这种请求axios的方式为什么不成功打印呢
<button onclick="switch1()">axios请求</button>
function switch1()
{
axios.get("https://www.autumnfish.cn/api/joke/list?num=6").then(function (response){console.log(response)})
}
请问这种请求axios的方式为什么不成功打印呢
加个catch捕获下看看?
axios.get('https://www.autumnfish.cn/api/joke/list?num=6')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
fetch("https://www.autumnfish.cn/api/joke/list?num=6").then(res => res.json().then(console.log))
F12 控制台,没有问题,检查下你的逻辑吧
13 回答12.8k 阅读
8 回答2.6k 阅读
2 回答5.1k 阅读✓ 已解决
3 回答2.2k 阅读✓ 已解决
5 回答850 阅读
3 回答2.2k 阅读
5 回答1.2k 阅读✓ 已解决
https://stackblitz.com/edit/j...
我写的这个可以打印出来