Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JavaScript POST request with Fetch API

const response = await fetch("https://reqbin.com/echo/post/json", {
method: 'POST',
headers: {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
},
body: `{
   "Id": 78912,
   "Customer": "Jason Sweet",
   "Quantity": 1,
   "Price": 18.00
  }`,
});

response.json().then(data => {
  console.log(data);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to add variable to local storage in javascript 
Javascript :: generate random 6 numbers in javascript 
Javascript :: javascript length of number 
Javascript :: chart js laravel mix 
Javascript :: get alert after using ajax 
Javascript :: js regex last occurrence 
Javascript :: get screen width javascript 
Javascript :: javascript loop through objec 
Javascript :: discord.js leave guild 
Javascript :: find an object in an array of objects javascript 
Javascript :: regex for lowercase letters js 
Javascript :: angular MatDialogRef spec 
Javascript :: uuid v4 
Javascript :: axios multipart/form-data 
Javascript :: jquery disable form element 
Javascript :: add 10 seconds to date javascript 
Javascript :: jquery delay to call function 
Javascript :: loop through object javascript 
Javascript :: vue small scroll 
Javascript :: how to change react icon color 
Javascript :: how to run method in method vue js on load 
Javascript :: how to access xpath in js 
Javascript :: react-native curved view 
Javascript :: current year javascript 
Javascript :: reverse key and value in object js 
Javascript :: javascript set localstorage 
Javascript :: fetch json file 
Javascript :: express js redirect to url 
Javascript :: event handling in react documentation 
Javascript :: open json file in current directory python 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =