Cofem/assets/scripts/global/account.js
2024-02-02 12:20:17 +01:00

30 lines
1000 B
JavaScript

function login() {
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
// Assuming you use fetch API to send data to the server
fetch('https://home.adlerka.top/account', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: {
action: 'login',
email: email,
password: password
},
})
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
document.getElementById("statusMessage").innerText = "Login successful!";
// Redirect or perform other actions after successful login
} else {
document.getElementById("statusMessage").innerText = "Login failed. Please check your credentials.";
}
})
.catch((error) => {
console.error('Error:', error);
});
}