Login auf jquery geändert
This commit is contained in:
35
js/components/admin_login.js
Normal file
35
js/components/admin_login.js
Normal file
@ -0,0 +1,35 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user