递归出题
This commit is contained in:
61
teaching/jwl/课件/js/apitest.html
Normal file
61
teaching/jwl/课件/js/apitest.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!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://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
用户名<input type="text" value="" id="account">
|
||||
</div>
|
||||
<div>
|
||||
密码 <input type="password" value="" id="pwd">
|
||||
</div>
|
||||
<button onclick="login()">登录</button>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<tr id="userlist">
|
||||
<th>用户编号</th>
|
||||
<th>用户名</th>
|
||||
<th>用户账号</th>
|
||||
<th>用户密码</th>
|
||||
<th>邮箱</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<script>
|
||||
$.ajax({
|
||||
url:"http://127.0.0.1:5000/userlist",
|
||||
success:function(res){
|
||||
// console.log(res)
|
||||
var ulist=JSON.parse(res)
|
||||
console.log(ulist)
|
||||
for(let i=0;i<ulist["data"].length;i++){
|
||||
$("table").append("<tr><td>"+ulist["data"][i].userid+"</td> <td>"+ulist["data"][i].username+"</td> <td>asd</td> <td>123</td><td>a@</td></tr>")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
function login(){
|
||||
console.log("aaaaaa")
|
||||
var data={account:$("#account").val(),pwd:$("#pwd").val()}
|
||||
$.ajax({
|
||||
url:"http://127.0.0.1:5000/login",
|
||||
type:"post",
|
||||
data:data,
|
||||
dataType:"json",
|
||||
success:function(res){
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user