Answers for "fetch follow redirect"

19

fetch api javascript

fetch('http://example.com/movies.json')
  .then((response) => {
    return response.json();
  })
  .then((myJson) => {
    console.log(myJson);
  });
Posted by: Guest on February-10-2020
4

fetch suntax

fetch('http://example.com/movies.json')
  .then((response) => {
    return response.json();
  })
  .then((data) => {
    console.log(data);
  });
Posted by: Guest on March-16-2020
0

redirect to website from promise value fetch

fetch("http://example.com/", {
	method: 'POST',
	mode: 'cors',
	body: formData
})
.then(dataWrappedByPromise => dataWrappedByPromise.text())
.then(data => {
	//Redirect is the URL inside the text of the response promise
	window.location.replace(data);
})
Posted by: Guest on May-14-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language