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.
Source: stackoverflow.com
Related Query
- axios post request to send form data in reactjs
- axios post request to send form data
- Axios post request of form data send nothing
- Send JSON data as multipart/form-data using axios POST Request
- React axios post request does not send the data
- How to append form data in an Axios Post request in REACT
- I want to send the data from a request form to a database in the MySQL workbench from a javascript file in a ReactJs project, but I have no idea how
- How to send user data and its profile image using POST request from axios api to Django Rest Framework?
- ReactJS axios POST request send all options as a single JSON key with empty value
- axios post request with json data
- react native post form data with object and file in it using axios
- Axios Post Form with Reactjs
- Laravel PATCH Request doesn't read Axios form data
- How to send POST data to flask using Reactjs fetch
- axios post data as form data instead of as JSON in payload
- How to send POST request to Django API from ReactJS web app?
- Canceling my promises a POST Request through axios in Reactjs
- React - Axios POST form data with files and strings
- axios doesn't send post data to the back-end
- Cannot send form data with axios when using interceptors
- $_FILES is empty when sending a POST request using axios in ReactJs
- How to send array of object in post request using axios library
- How to get axios post data request on nodeJs
- How to fix issue while passing ReactJS state data in post request using axios?
- Axios GET request for form encoded data
- How to post form data from reactjs to controller in mvc asp.net
- How to send data as string and not json on axios post
- how can i post data from reactjs form to mysql database
- Axios post does not send data
- Request failed with status code 500 error. When making form post of multiForm data in React
More Query from same tag
- Navigate to route using hashHistory
- Unable to map through dynamically created array through redux
- What is the difference between useQuery and useLazyQuery in Apollo graphQL?
- How can I mock useQuery from react-fetching-library?
- React - dynamically create select all checkboxes
- What's the right way for push json result to array in ReactJS?
- How to pass a default value to an input in React (using props)
- Calling a ref from another component (?)
- react-select can load async data
- Changing Unicode symbols (") to the equivalent html symbol (")
- How to calculate sum of items and total price with React?
- Connection refused on localhost
- Redux-form loading indicator while auto saving
- Error: Cannot read property "name" of undefined. However, after the page is refreshed, the error is removed
- React adding fields from a drop down menu
- React how to update another component's state?
- Receiving data from server as json data but not able to parse the data in react
- React - Array Splice Trouble
- A method to manage keyboard shortcuts in react
- React Router v6 - nested routing without Outlet
- Module not found: Error: Package path . is not exported from package react
- How can I rename index.html in a create-react-app project?
- using setInterval and setimeout to make 3 components load after each other
- How to style YAxis recharts to make it ellipsis if label too long?
- How to configure Ckeditor Toolbar in React JS?
- React JS JSX Show or Hide Based on Another Toggle Component
- Using withAuthenticator component with connect from react-redux
- Making NavItem Background color the same as NavBar
- Jest test case gives Unexpected token in dynamic import() error
- React/Redux chaining async thunk actions at component level