<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>layui 前端分页示例</title>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<table id="demo" lay-filter="test"></table>
<script type="text/html" id="barDemo">
<button class="layui-btn layui-btn-xs">查看</button>
</script>
<div id="pagination"></div>
<script src="layui/axios.min.js"></script>
<script src="layui/layui.js"></script>
<script>
layui.use(['table', 'laypage'], function(){
var table = layui.table;
var laypage = layui.laypage;
// 创建 FormData 对象
const formData = new FormData();
formData.append('username', 'yansiyu');
formData.append('password', '111111');
console.log(formData.get('username')); // 输出: yansiyu
console.log(formData.get('password')); // 输出: yansiyu
axios.defaults.withCredentials = true;
axios.get('https://www.yuanchengzhushou.cn/login.php',
{
withCredentials: true // 设置为 true 以确保跨域时带上 Cookie
}).then(response => {
data = response.data.data; // 获取返回的响应数据
})
.catch(error => {
console.error('请求错误:', error);
});
axios.defaults.withCredentials = true;
axios.get('https://www.yuanchengzhushou.cn/admin.php',{
withCredentials: true // 设置为 true 以确保跨域时带上 Cookie
}).then(response => {
data = response.data.data; // 获取返回的响应数据
// alert("请求2成功");
})
.catch(error => {
console.error('请求错误:', error);
});
});
//登录
</script>
</body>
</html>