axios send post data
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
headers: {'Authorization': 'Bearer ...'}
});
axios send post data
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
headers: {'Authorization': 'Bearer ...'}
});
axios api post request
import qs from 'qs';
const data = { 'bar': 123 };
const options = {
method: 'POST',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: qs.stringify(data),
url,
};
axios(options);
axios post
//EXAMPLE INPUTS
const url='/'
const data={
name1:value1,
name2:value2
}
//ACTUAL USAGE
const parsedData = new URLSearchParams();
Object.getOwnPropertyNames(data).map((property) =>
parsedData.append(property, data[property])
);
axios
.post(url, parsedData)
.then((res) => {
//handle result
})
.catch((err) => {
//handle error
});
axios post
axios.post('https:sample-endpoint.com/user', {
Name: 'Fred',
Age: '23'
})
.then(function (response) {
console.log(response);
})
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us