init
This commit is contained in:
65
Html-Javascript/36-axios.html
Normal file
65
Html-Javascript/36-axios.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<!-- 引入文件 -->
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- axios 是正对于Ajax的一个库 -->
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
// 00- 用axios 发送请求
|
||||
// axios({
|
||||
// url: "http://127.0.0.1:7890", // 请求地址
|
||||
// method: "POST", // 默认是GET 请求方式
|
||||
// })
|
||||
|
||||
|
||||
// 01- 用axios 发送数据
|
||||
// GET
|
||||
// axios({
|
||||
// url: "http://127.0.0.1:7890/lbt", // 请求地址
|
||||
// method: "GET", // 默认是GET 请求方式
|
||||
// params: {
|
||||
// key: "value"
|
||||
// },
|
||||
// })
|
||||
|
||||
// POST
|
||||
// axios({
|
||||
// url: "http://127.0.0.1:7890/lbt", // 请求地址
|
||||
// method: "POST", // 默认是GET 请求方式
|
||||
// data: {
|
||||
// key: "value"
|
||||
// },
|
||||
// })
|
||||
|
||||
|
||||
// 02- 请求头的设置
|
||||
// axios({
|
||||
// url: "http://127.0.0.1:7890/lbt", // 请求地址
|
||||
// method: "POST", // 默认是GET 请求方式
|
||||
// data: {
|
||||
// key: "value"
|
||||
// },
|
||||
// // 修改请求头
|
||||
// headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||
// })
|
||||
|
||||
|
||||
// 拦截器 选修内容 可以自行了解
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user