=================================================================== RCS file: /cvs/cvs/draft/form.min.js,v retrieving revision 1.27 retrieving revision 1.38 diff -u -p -r1.27 -r1.38 --- draft/form.min.js 2024/03/28 19:22:50 1.27 +++ draft/form.min.js 2024/03/28 20:24:58 1.38 @@ -13,19 +13,6 @@ function validateMsg(msg) { return (msg.length>5); } -//async function postData() { -// const formData = new FormData(form); -// try { -// const response = await fetch("/feedbk/", { -// method: "POST", -// body: formData, -// }); -// console.log(await response.json()); -// } catch (e) { -// console.error(e); -// } -//} - async function sendData() { var er = 0; em = document.getElementById("cfem").value, @@ -49,19 +36,34 @@ async function sendData() { turnstile.render('#cfcontainer', { theme: 'light', sitekey: '0x4AAAAAAAVpXFEy152AON1L', + 'response-field': false, + retry: 'never', 'error-callback': function(e) { turnstile.remove(); }, callback: function(token) { ii.textContent="Sent"; console.log(`Challenge Success ${token}`); -// postData(); -var data=`${token}|${em}|${su}|${ms}`, - status=""; -$.post("/feedbk/", function(data, status){ +/* --------------------- */ +var data="", + status="", + feed=JSON.stringify({ "cfem": "a@b.ru", "cfsu" : "subject", "cfme" : "message", "cfto" : "token" }); +$.post("/feedbk/", feed, function(data, status){ console.log("Data: " + data + "\nStatus: " + status); }); - +/* --------------------- */ +//var re=""; +//re=fetch('/feedbk/', { +// method: 'POST', +// headers: { +// 'Accept': 'application/json', +// 'Content-Type': 'application/json' +// }, +// body: JSON.stringify({ "cfem": "a@b.ru", "cfsu" : "subject", "cfme" : "message", "cfto" : "token" }) +//}); + // .then(response => response.json()) + // .then(response => console.log(JSON.stringify(response))) +// console.log(re); },