一个基于Promise 用于浏览器和 nodejs 的 HTTP 客户端(可实现ajax的请求)
有关学习网址:https://www.tuicool.com/articles/eMb2yuY 、 https://www.kancloud.cn/yunye/axios/234845
此记录只是为了有个印象,后面还需在实际操作中学习。
执行post请求
axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }) .then(function(response){ console.log(response); }) .catch(function(error){ console.log(error); })
一、执行Get请求
axios.get() .then(function(response){ Console.log(response); }) .catch(function(errror){ console.log(error); });