<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="./js/jquery-3.6.0.min.js"></script>
<title>Title</title>
</head>
<script>
var jsonData = JSON.stringify({
"account": "wuzm",
"password": "xmgl0592"
});//转为json字符串
$.ajax({
type: "post",
dataType: "json",
url: "http://s/user/login" ,
data: jsonData, //提交的数据
headers:{'Content-Type': 'application/json'},
success: function (result) {
document.cookie = `Admin-Token=${result.data.token};path=/`
console.log(document.cookie,'dddd')
document.location.href = 'http://coclpit'//打印服务端返回的数据(调试用)
},
error : function() {
alert("未知错误请联系管理员");
}
});
</script>
<body>
<div id="zzzzzzz">
</div>
</body>
</html>
JQ调接口,html页面
最新推荐文章于 2024-04-08 08:09:24 发布