ফেচ (fetch)
fetch('url')
.then(response => {
//handle response
console.log(response);
})
.then(data => {
//handle data
console.log(data);
})
.catch(error => {
//handle error
});fetch('url', {
Method: 'POST',
Headers: {
Accept: 'application.json',
'Content-Type': 'application/json'
},
Body: body,
Cache: 'default'
}).then(response => {
//handle response
console.log(response);
})
.then(data => {
//handle data
console.log(data);
})
.catch(error => {
//handle error
});Last updated