<div id=“resultText“ style=“margin-top:20px; padding:10px; background:#f3f3f3; border:1px solid #ccc;“>
<!– Hier erscheint der GPT-Text –>
</div>
<script>
document.addEventListener(‚wpcf7submit‘, async function(event) {
const inputs = event.detail.inputs;
const thema = inputs.find(i => i.name === ‚thema‘)?.value || “;
const data = { keyword: thema };
console.log(„Sende an Make:“, data);
try {
const res = await fetch(„https://hook.eu2.make.com/ubwu5vsrw262ajl4g6jdax9vxqcv5vx5“, {
method: „POST“,
headers: { „Content-Type“: „application/json“ },
body: JSON.stringify(data)
});
const text = await res.text();
document.getElementById(„resultText“).innerHTML = text;
} catch (error) {
console.error(„Fehler beim Senden an Make:“, error);
document.getElementById(„resultText“).innerHTML = „Fehler beim Abruf. Bitte später erneut versuchen.“;
}
});
</script>