[BACK]Return to form.min.js CVS log [TXT][DIR] Up to [local] / draft

Diff for /draft/form.min.js between version 1.17 and 1.18

version 1.17, 2024/03/28 15:25:49 version 1.18, 2024/03/28 18:50:37
Line 14  function validateMsg(msg) {
Line 14  function validateMsg(msg) {
 }  }
   
 async function sendData() {  async function sendData() {
           const form = document.querySelector("#cform");
           const formData = new FormData(form);
         var er = 0;          var er = 0;
                 em = document.getElementById("cfem").value,                  em = document.getElementById("cfem").value,
                 su = document.getElementById("cfsu").value,                  su = document.getElementById("cfsu").value,
Line 42  async function sendData() {
Line 44  async function sendData() {
                                 callback: function(token) {                                  callback: function(token) {
                                         ii.textContent="Sent";                                          ii.textContent="Sent";
                                         console.log(`Challenge Success ${token}`);                                          console.log(`Challenge Success ${token}`);
   /* ---------- */
     try {
       const response = await fetch("https://draft.hgk.global/feedbk/", {
         method: "POST",
         body: formData,
       });
       console.log(await response.text());
     } catch (e) {
       console.error(e);
     }
   }
   /* ---------- */
   
                                 },                                  },
                         });                          });
                 });                  });
Line 51  async function sendData() {
Line 66  async function sendData() {
 form.addEventListener("submit", (event) => {  form.addEventListener("submit", (event) => {
         event.preventDefault();          event.preventDefault();
         sendData();          sendData();
 });  });
   
   // Associate the FormData object with the form element  
  // const formData = new FormData(form);  
   
  // try {  
  //   const response = await fetch("https://example.org/post", {  
  //     method: "POST",  
       // Set the FormData instance as the request body  
 //      body: formData,  
  //   });  
  //   console.log(await response.json());  
 //  } catch (e) {  
 //    console.error(e);  
 //  }  
 //}  
   
 // Take over form submission  
   

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

https://cvs.kroczynski.net