Clickhandler

This commit is contained in:
wiecktobi 2018-06-08 17:31:10 +02:00 committed by GitHub
parent 74c33ca0db
commit 5ab908d255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
window.addEventListener('load', async () => { window.addEventListener('load', async () => {
console.log("Seite geladen"); console.log("Seite geladen");
getNewUniqueLink(); getNewUniqueLink();
document.getElementById('create').addEventListener('click' , async (event) => createEntry());
}) })
async function getNewUniqueLink() { 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");
}
}