top 10 boilerplate ever

This commit is contained in:
biglyderv 2024-09-07 18:12:58 -04:00
commit d0cc234857
No known key found for this signature in database
GPG key ID: 33AC87E9ACE66954
17 changed files with 567 additions and 0 deletions

0
static/main.css Normal file
View file

24
static/main.js Normal file
View file

@ -0,0 +1,24 @@
async function formClick(ev) {
ev.preventDefault();
let { target } = ev;
let fetched = await fetch(target.action, {
'method': 'POST',
'body': new FormData(target)
});
let json = await fetched.json();
document.querySelector('.form-message').textContent = json.message;
if (json.redirect) {
setTimeout(function () {
window.location.href = json.redirect;
}, 2000);
}
}
window.onload = function () {
document.addEventListener('submit', formClick);
}