score:0

can you do console.log(bodyformdata) before you make the post request and see what's being posted?

to me that seems like where the error would be if you're getting a success response from axios.

score:0

why not do these operations in the function you submitted the form?

have you tried doing it this way?

const onsubmit = async () => {
   var bodyformdata = new formdata();
   bodyformdata.append("sale", "");
   bodyformdata.append("district", "");
   bodyformdata.append("billing", "");
      
     await axios({
        method: "post",
        url: "http://localhost:8080/form",
        data: bodyformdata,
        headers: { "content-type": "application/x-www-form-urlencoded" },
      })
        .then(function (response) {
          //handle success
          console.log(response);
        })
        .catch(function (response) {
          //handle error
          console.log(response);
        });
    }

in fact, if you want, update the form data when submitting the form directly, not with change.


Related Query

More Query from same tag