async function sendContact(ev) { ev.preventDefault(); const thePage = window.location.href; const senderAddress = document.getElementById('emailInput').value; const senderMessage = document.getElementById('messageInput').value; if (document.getElementById('dopost').checked) { postpref = 'do'; } else if (document.getElementById('dontpost').checked) { postpref = 'do not'; } else { postpref = 'either'; }; if (document.getElementById('doreply').checked) { replypref = 'do'; } else if (document.getElementById('dontreply').checked) { replypref = 'do not'; } else { replypref = 'either'; }; const gtsUrl = 'https://kes.praze.net/api/v1/statuses'; const response = await fetch(gtsUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer TOKEN', }, body: JSON.stringify({'status' : 'new comment on ' + thePage + ' from an anonymous person (' + senderAddress + ')\n\n' + senderMessage + '\n\npost: ' + postpref + ', reply: ' + replypref}), }); if (response.ok) { alert('Comment submitted, thank you!'); } else { alert('This is fucked, sorry. Email me instead, whatever at praze dot net!'); } document.getElementById("theform").reset(); }