spinn_mit/js/functions.js

57 lines
1.6 KiB
JavaScript
Raw Normal View History

/* ideeSpeichern();
function ideeSpeichern(titel, inhalt) {
let url = "system/ideeSpeichern.php";
let formData = new FormData();
formData.append('titel', titel);
formData.append('inhalt', inhalt);
fetch(url,
{
body: formData,
method: "post",
})
.then((response) => {
return response.json();
})
.then((markerData) => {
}
.catch(function(error) {
console.log("error: " + error.message);
});
}
*/
function ideeAnzeigen(data) {
document.querySelectorAll('.loeschen').forEach(e => e.remove());
let titelErstellen = document.createElement("h1");
let titelInhalt = document.createTextNode(data.titel);
titelErstellen.appendChild(titelInhalt);
titelErstellen.classList.add("loeschen")
document.getElementById('idee').appendChild(titelErstellen);
let inhaltErstellen = document.createElement("p");
let inhaltInhalt = document.createTextNode(data.inhalt);
inhaltErstellen.appendChild(inhaltInhalt);
inhaltErstellen.classList.add("loeschen")
document.getElementById('idee').appendChild(inhaltErstellen);
let likesErstellen = document.createElement("p");
let likes = document.createTextNode(data.likes + " Likes");
likesErstellen.appendChild(likes);
likesErstellen.classList.add("loeschen")
document.getElementById('idee').appendChild(likesErstellen);
let bild = document.createElement("img");
bild.src = "https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg";
bild.classList.add("ideeBilder")
bild.classList.add("loeschen")
document.getElementById('idee').appendChild(bild);
}