=================================================================== RCS file: /cvs/cvs/draft/form.min.js,v retrieving revision 1.30 retrieving revision 1.37 diff -u -p -r1.30 -r1.37 --- draft/form.min.js 2024/03/28 19:43:10 1.30 +++ draft/form.min.js 2024/03/28 20:14:58 1.37 @@ -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,7 +36,7 @@ async function sendData() { turnstile.render('#cfcontainer', { theme: 'light', sitekey: '0x4AAAAAAAVpXFEy152AON1L', - response-field: 'false', + 'response-field': false, retry: 'never', 'error-callback': function(e) { turnstile.remove(); @@ -57,13 +44,25 @@ async function sendData() { callback: function(token) { ii.textContent="Sent"; console.log(`Challenge Success ${token}`); -// postData(); -var data="", - status=""; -$.post("/feedbk/", token, 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=""; +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); },