Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js fetch json

var myRequest = new Request('products.json');//GET
var myRequest = new Request('products.json', {method: "post"});//POST

fetch(myRequest)
  .then(response => response.json())
  .then(data => {
    console.log(data);
  })
  .catch(console.error);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #fetch #json
ADD COMMENT
Topic
Name
6+1 =