我有两页登录页面和忘记密码页面我想在登录页面上隐藏表单并加载那里忘记页面内容超链接点击。但是,当我点击超链接登录页面时,将其自身加载到为忘记页面指定的div中,并且控制台会抛出此警告。
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
我正在使用jquery加载函数
Heres js:
$(function() {
$(".forgotPassword").click(function() {
$(".login-block").hide();
$(".frame-container").load("forgotPassword.jsp");
return false;
});
$('input[name="send"]').click(function(e){
e.preventDefault();
var params = "email=" + $(".email").val();
$.ajax({
url:$(".forgot-block").attr("action"),
type: 'get',
data: params,
sucess: function(data) {
alert(data);
}
});
});
});
Heres loginpage.jsp:
<body>
<center>
<div class="center-container">
<div id="header">
<div class="login-header">KOŠICE <span>DEVICES</span></div>
<div id="nav" class="login-nav" ></div>
</div>
<div id="login-error">${error}</div>
<form action="<c:url value="/j_spring_security_check"></c:url>" method="post" role="form" class="login-block">
<p>WELCOME, PLEASE LOG IN!</p>
<p >
<!-- <label for="j_username">Email</label> -->
<input id="j_username" name="j_username" type="email" placeholder="Email" />
</p>
<p>
<!-- <label for="j_password">Password</label> -->
<input id="j_password" name="j_password" type="password" placeholder="Password" />
</p>
<p>
<input type="submit" name="login" id="j_login" value="Log In" />
</p>
<p>
<a href="#" class="forgotPassword">FORGOT PASSWORD ?</a>
</p>
</form>
<div class="frame-container"></div>
</div>
</center>
</body>
Heres forgotpassword.jsp:
<form action="/forgotPassword" method="post" role="form" class="forgot-block">
<p>ENTER YOUR EMAIL</p>
<p><input id="j_username" name="j_username" type="email" placeholder="Email" class="email"/></p>
<p><input type="submit" name="send" id="j_login" value="Send" /></p>
</form>
js脚本作为外部脚本加载到登录页面的头部。