美文网首页
JavaWeb--axios

JavaWeb--axios

作者: 何以解君愁 | 来源:发表于2022-07-27 19:37 被阅读0次

Axios:对原生的AJAX进行封装,简化书写
官网:https://www.axios-http.cn

使用:①引入axios的js文件
<script src="js/ .js"></script>
②使用axios发送请求,并获取响应结果
axios({
        method:"get",
        url:"http://localhost:8888/axiosServlet?username=zs"
    }).then(function (resp){
        alert(resp.data);
    })

Axios请求方式别名(为方便起见,Axios为所有支持的请求方式提供了别名)
axios.get(url[,config]) axios.delete(url[,config])  axios.head(url[,config])    axios.options(url[,config])
axios.post(url[,data[,config]]) axios.put(url[,data[,config]])  axios.patch(url[,data[,config]])
axios.get("http://localhost:8888/axiosServlet?username=zs").then(function (resp){
        alert(resp.data);
    })

相关文章

  • JavaWeb--axios

    Axios:对原生的AJAX进行封装,简化书写官网:https://www.axios-http.cn[https...

网友评论

      本文标题:JavaWeb--axios

      本文链接:https://www.haomeiwen.com/subject/vhvzirtx.html