35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
function login(){
|
|
var mail = document.getElementById("mail").value;
|
|
var password = document.getElementById("password").value;
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '../controller/admin_login.php',
|
|
data: {
|
|
'function': 'login',
|
|
'mail': mail,
|
|
'password': password
|
|
},
|
|
success: function(result) { //we got the response
|
|
if(result!=''){
|
|
var a = result.split('|***|');
|
|
if(a[1]=="success"){
|
|
document.getElementById("mail").value ="";
|
|
document.getElementById("password").value ="";
|
|
$('#msg').show().delay(1000).fadeOut(500);
|
|
$('#msg').html(a[0]);
|
|
$(document).ajaxStop(function(){
|
|
setTimeout(() => { window.location = "startseite.php"; }, 1000);
|
|
});
|
|
|
|
}else{
|
|
$('#msg').show().delay(10000).fadeOut(500);
|
|
$('#msg').html(a[0]);
|
|
}
|
|
}
|
|
},
|
|
error: function(xhr, status, exception) {
|
|
console.log(xhr);
|
|
}
|
|
});
|
|
} |