<script>
if (sessionStorage.getItem("user_sign_num") > 0) {
sessionStorage.setItem("user_sign_num", sessionStorage.getItem("user_sign_num"));
change();
}
function button() {
var email = document.getElementById("email").value;
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var repwd = document.getElementById("repwd").value;
var contextRoot = /*[[@{/}]]*/ '';
// /?email="+email+"&username="+username+"&password="+password+"&repwd="+repwd,
//获取根路径,代表这个网页的路径,注意写法
console.log(email+username+password+repwd);
$.ajax({
type: "get",
//注意这里
url: contextRoot+"sign-up",
data:{
email:email,
username:username,
password:password,
repwd:repwd,
},
//使用post时,必须这么写:application/x-www-form-urlencoded
contentType: "application/x-www-form-urlencoded",
success: function (msg) {
alert(msg);
},
error: function () {
alert("网络出现了问题!!")
}
});
sessionStorage.setItem("user_sign_num", 60);
change();
}
Thymeleaf中使用ajax的注意点
最新推荐文章于 2024-06-26 13:14:42 发布