-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
94 lines (86 loc) · 2.22 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="">
</head>
<body>
<input type="text" id="username">
<input type="text" id="password">
<button id="login">登录</button>
<button id="btn">请求</button>
<button id="logout">退出</button>
<input type="text" id="oldpassword">
<input type="text" id="newpassword">
<button id="editpassword">修改密码</button>
</body>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script>
$.ajaxSetup({
xhrFields: {
withCredentials: true
},
crossDomain:true,
})
$('#login').click(function () {
$.ajax({
url: 'http://127.0.0.1/login',
type: 'post',
data: {
username: $('#username').val(),
password:$('#password').val()
},
success: function (data) {
console.log(FormData)
token = data.token
}
})
})
$('#req').click(function(){
$.ajax({
url:'http://127.0.0.1/user',
type:'get',
data:{
token:token
},
success:function(){
}
})
})
$('#btn').click(function(){
$.ajax({
url:'http://127.0.0.1/article/list',
type:'get',
data:{
pageNo:1,
pageSzie:1
},
success:function(){
}
})
})
$('#logout').click(function(){
$.ajax({
url:'http://127.0.0.1/logout',
type:'post',
success:function(){
}
})
})
$('#editpassword').click(function(){
$.ajax({
url:'http://127.0.0.1/editPassword',
type:'post',
data:{
oldPass:$('#oldpassword').val(),
newPass:$('#newpassword').val()
},
success:function(){
}
})
})
</script>
</html>