2 回答
TA贡献1856条经验 获得超5个赞
您可以在每个 div 标签中将警报消息保存为数据属性。例如:
<div id="login" data-msg="message1"></div>
<div id="lostpasswordform" data-msg="message2"></div>
<div id="register" data-msg="message3"></div>
// then you can invoke them like this
let getLoginPassSystem = function (getPassForgotSystem, getLoginCheckSystem) {
$(document).ready(function () {
$('#login,#lostpasswordform,#register').submit(function (e) {
e.preventDefault();
let current_form = $(this);
$.ajax({
type: "POST",
url: 'http://www.virtuelles-museum.com.udev/spielelogin/logsystem.php',
data: $(this).serialize(),
success: function (response) {
var data = JSON.parse(response);
if (data.success == "accepted") {
document.getElementById('inner').innerHTML = 'Herzlich Willkommen';
// location.href = 'index.php';
} else {
alert(current_form.attr('data-msg'));
}
}
});
});
})
}
添加回答
举报