=================================================================== RCS file: /cvs/cvs/draft/form.min.js,v retrieving revision 1.26 retrieving revision 1.39 diff -u -p -r1.26 -r1.39 --- draft/form.min.js 2024/03/28 19:19:40 1.26 +++ draft/form.min.js 2024/03/28 20:27:38 1.39 @@ -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,18 +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){ - alert("Data: " + data + "\nStatus: " + status); }); - +/* --------------------- */ +var data="", + status="", + feed=JSON.stringify({ "cfem": "${em}", "cfsu" : "${su}", "cfme" : "${me}", "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); },