let getLoginPassSystem = function (getPassForgotSystem, getLoginCheckSystem) {
$(document).ready(function () {
$('#login,#lostpasswordform,#register').submit(function (e) {
e.preventDefault();
$.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('Ungültige Email oder Password!');
}
}
});
});
})
}
Well, I want to have for every form(#login,#lostpasswordform,#register) an different "alert". Is it actually possible?
2
Answers
It seems like you can simply check the
e.target
– it will be different for every form.You can get more information about
Event.target
here: https://developer.mozilla.org/en-US/docs/Web/API/Event/targetYou can save an alert massage in each div tag as data attribute. For example: