Skip to content

Instantly share code, notes, and snippets.

@PadreSVK
Created December 15, 2019 21:15
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 PadreSVK/6df6da97d78008df9ae5e2c7a9fe4b8d to your computer and use it in GitHub Desktop.
Save PadreSVK/6df6da97d78008df9ae5e2c7a9fe4b8d to your computer and use it in GitHub Desktop.
Get data from server
document.cookie
const response = await fetch('https://localhost:5001/weather/GetAllCities', {method: "POST"});
const myJson = await response.json();
console.log(JSON.stringify(myJson));
fetch('https://localhost:5001/weather', {method: "POST"})
.then(response => response.json())
.then(json=> console.log(JSON.stringify(json)))
const xhr = new XMLHttpRequest();
xhr.open('POST', 'https://localhost:5001/weather/GetAllCities', true);
xhr.withCredentials = true;
xhr.send();
xhr.response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment