第二题完
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
<!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>Ajax-Axios</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<input type="button" value="获取数据GET" id="btnGet">
|
||||
<input type="button" value="操作数据POST" id="btnPost">
|
||||
|
||||
@@ -15,13 +17,19 @@
|
||||
<script>
|
||||
//发送GET请求
|
||||
document.querySelector('#btnGet').addEventListener('click', () => {
|
||||
|
||||
axios.get('https://mock.apifox.cn/m1/3083103-0-default/emps/list').then((result) => {
|
||||
console.log(result.data)
|
||||
})
|
||||
console.log('-------------------------');
|
||||
})
|
||||
|
||||
|
||||
//发送POST请求
|
||||
document.querySelector('#btnPost').addEventListener('click', () => {
|
||||
|
||||
axios.post('https://mock.apifox.cn/m1/3083103-0-default/emps/update', 'id=1').then((result) => {
|
||||
console.log(result.data)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user