Files
Inventory-Manager/public/javascripts/login.js
T
2025-01-12 02:38:12 +00:00

16 lines
543 B
JavaScript

document.addEventListener('DOMContentLoaded', () => {
$('#loginBtn').click(() => {
const username = $('#username').val();
const password = $('#password').val();
$.post('/auth/login', { username, password })
.done((data) => {
alert(data.message);
// Redirect to another page
window.location.href = '/inventory';
})
.fail((jqXHR) => {
alert('Login failed: ' + jqXHR.responseText);
});
});
});