diff --git a/js/contentloader.js b/js/contentloader.js index c019e83..a6ce3fb 100644 --- a/js/contentloader.js +++ b/js/contentloader.js @@ -1,6 +1,7 @@ window.addEventListener('load', async () => { console.log("Seite geladen"); getNewUniqueLink(); + document.getElementById('create').addEventListener('click' , async (event) => createEntry()); }) async function getNewUniqueLink() { @@ -15,3 +16,18 @@ async function getNewUniqueLink() { } } +async function createEntry() { + event.preventDefault() + const formData = new formData(document.getElementById('create-form')); + + try { + const response = await fetch('php/login.php', { + method: 'post', + body: formData + }); + const jsonData = await response.json(); + + } catch (e) { + console.log("Fehler"); + } +}