Clickhandler
This commit is contained in:
parent
74c33ca0db
commit
5ab908d255
@ -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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user