=================================================================== RCS file: /cvs/cvs/draft/form.min.js,v retrieving revision 1.27 retrieving revision 1.34 diff -u -p -r1.27 -r1.34 --- draft/form.min.js 2024/03/28 19:22:50 1.27 +++ draft/form.min.js 2024/03/28 20:06:56 1.34 @@ -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){ - console.log("Data: " + data + "\nStatus: " + status); -}); - +/* --------------------- */ +//var data="", +// status=""; +//$.post("/feedbk/", token, function(data, status){ +// console.log("Data: " + data + "\nStatus: " + status); +//}); +/* --------------------- */ +var 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))) + .then(re => response.text()); + console.log(re); },