1.先准备一个后台接口地址:http://www.bingjs.com:81/Student/GetAll
2.展现学生信息:先制作一个表格,在请求数据,最后把数据添加到表格中。实现代码:
<!DOCTYPE html>
<html>
<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>调用后台接口:展示学生信息</title>
<style>
table{
border-collapse: collapse;
}
td,th{
border: 1px solid #ccc;
padding: 5px 20px;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>学号</th>
<th>姓名</th>
<th>性别</th>
<th>年级</th>
<th>电话</th>