js fetch delete
fetch('https://example.com/delete', {
method: 'DELETE'
})
.then(res => res.json())
.then(data => {
// Do some stuff...
})
.catch(err => console.log(err));
js fetch delete
fetch('https://example.com/delete', {
method: 'DELETE'
})
.then(res => res.json())
.then(data => {
// Do some stuff...
})
.catch(err => console.log(err));
fetch api template
//fetch api template
const fetchData=(inputs)=>{
fetch('https://example.com/api', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(inputs)
})
.then(function(response) {
return response.json();
})
.then(function(data) {
ChromeSamples.log(data.whatever);
});
}
Fetch patch method
return (
fetch(API_ROOT + route, {
method: 'POST',
crossDomain: true,
xhrFields: {
withCredentials: true
},
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'_method': 'PATCH',
'Authorization': ''
},
data: JSON.stringify(data)
})
.then(res => res.json())
.then(res => {
console.log(res);
return res
})
.catch(err => console.error(err))
);
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