stylehub/assets/scripts/global/account.js

28 lines
990 B
JavaScript
Raw Normal View History

2024-02-01 09:46:52 +01:00
function login() {
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
2024-02-02 12:28:37 +01:00
const data = new URLSearchParams();
data.append("action", "login");
data.append("email", email);
data.append("password", password);
2024-02-01 09:46:52 +01:00
// Assuming you use fetch API to send data to the server
fetch('https://home.adlerka.top/account', {
method: 'POST',
2024-02-02 12:28:37 +01:00
body: data,
2024-02-01 09:46:52 +01:00
})
.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);
});
}