<!DOCTYPE html>
<html lang="en" xmlns:th="www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title></title>
<script th:src="@{../js/aes.js}"/>
<script th:src="@{../js/pad-zeropadding.js}"/>
<script th:src="@{../js/security.js}"/>
<script th:src="@{../js/jquery.min.js}"/>
</head>
<body>
<button onclick="saveUser()">保存</button>
<button onclick="findUser()">查找用户</button>
<script>
function saveUser() {
console.log("发送数据:"+Encrypt(JSON.stringify({loginName:"张三"})));
$.ajax({
type:"post",
url:"/save",
data:Encrypt(JSON.stringify({loginName:"张三"})),
dataType:"json",
contentType:"application/json",
success:function(result){
console.log("返回数据:"+result);
console.log("解密之后:"+Decrypt(result));
console.log("解密之后转json对象:"+JSON.parse(Decrypt(result)));
}
});
}
function findUser() {
$.get("/find",function (result) {
console.log("--result:"+Decrypt(result));
});
}
</script>
</body>
</html>
AES页面加解密
最新推荐文章于 2021-02-24 17:03:27 发布