今日总结:Axios
Axios是对原生的AJAX进行封装,简化书写
1.引入axios的js文件
<script src="js/axio-0.18.0.js"></script>
2.使用axios发送请求,并获取响应结果
get方式
axios({
method:“get”;
url:"http://localhost:8080/ajax-demo1/aJaxDemo1?username=zhangsan"
}).then(function(resp){
alert(resp.data);
})
axios({
method:“post”;
url:"http://localhost:8080/ajax-demo1/aJaxDemo1?",
data:"username=zhangsan"
}).then(function(resp){
alert(resp.data);
});

浙公网安备 33010602011771号