dimanche 27 juin 2021

Javascript, fetch a url instead of a direct file path

This works fine:

fetch("./xml/Stories.xml").then((response) => {
  response.text().then((xml) => {
    xmlContent = xml;

But I would like to get my data from a website which has a link that only displays the xml, how would I go about retrieving the data through a link instead of a direct file path?

I.E:

fetch("https://Example.com/").then((response) => {
  response.text().then((xml) => {
    xmlContent = xml;



Aucun commentaire:

Enregistrer un commentaire