Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Send Data Using Fetch With Then Syntax


	fetch('/test', {method:"POST", body:JSON.stringify({name:"NAME"}), headers: {'Content-type': 'application/json; charset=UTF-8'}})
    .then(response => response.json())
    .then(data => console.log(data.name));
/*console log 'Name'*/
Comment

Send Data Using Fetch

 
async function sendMe()
{

let r =await fetch('/test', {method: 'POST', body: JSON.stringify({a:"aaaaa"}), headers: {'Content-type': 'application/json; charset=UTF-8'}})
let res = await r.json();
console.log(res["a"]);
}
 
Comment

PREVIOUS NEXT
Code Example
Javascript :: uuid use in express 
Javascript :: urlencoded json express 
Javascript :: js push param to url 
Javascript :: document.getelementsbytagname 
Javascript :: javascript stringify an object 
Javascript :: angular copy 
Javascript :: console.log color 
Javascript :: datalist example 
Javascript :: how to read a firebase txt file 
Javascript :: comprimento string javascript 
Javascript :: ng generate component in folder 
Javascript :: moment date difference in days 
Javascript :: react localstorage remove item 
Javascript :: mongoose nullable 
Javascript :: sort alphabetically javascript 
Javascript :: how to block special characters in javascript 
Javascript :: socket io broadcast to room 
Javascript :: discord.js ticket system stackoverflow 
Javascript :: mongoDb Importar json para DataBase 
Javascript :: regex only letters not spaces 
Javascript :: expo ignore warnings 
Javascript :: marketo landing page locked content 
Javascript :: laravel ajax delete 
Javascript :: js string to bytes 
Javascript :: find in array of objects javascript 
Javascript :: javascript find number in string 
Javascript :: javascript get name of element 
Javascript :: node js request async await 
Javascript :: div onchange react 
Javascript :: scroll back to top on every transition in react 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =