Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fetch

// Get
fetch('<your-url>')
  .then((response) => response.json()).then(console.log).catch(console.warn);

// POST, PUT
data = "your data"
fetch('<your-url>', {
  method: 'POST', // or 'PUT'
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(data),
})
.then(response => response.json()).then(console.log).catch(console.warn);
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #fetch
ADD COMMENT
Topic
Name
5+7 =