Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created June 1, 2020 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/292da0964d1048c26ac2429d5b108a8a to your computer and use it in GitHub Desktop.
Save parzibyte/292da0964d1048c26ac2429d5b108a8a to your computer and use it in GitHub Desktop.
const datos = {
nombre: "Luis Cabrera Benito",
web: "parzibyte.me",
};
const respuestaRaw = await fetch("http://sitio.com", {
body: JSON.stringify(datos), // <-- Aquí van los datos
headers: {
"Content-Type": "application/json", // <-- Importante el encabezado
},
method: "POST",
});
const jsonDecodificado = await respuestaRaw.json();
console.log(jsonDecodificado);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment