Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

262
Visualizações
Running fetch API in local windows machine by using visual studio code

I am totally new to web development if somebody can help me to start to use Fetch API. Can I run the HTML and vanilla JS (with JS Fetch API functionality) on my windows computer? I was looking around and found visual studio code and a live server. It looks like it can load the page on the server but still, it is not clear what kind of JS library I should include for enabling Fetch API. I just want to execute the following code on my laptop (would be nice if I don't use any JS library though I am not sure if it is possible or not)

<script>
let file = "fetch_info.txt"  //assuming the file is located in my server

fetch (file)
.then(x => x.text())
.then(y => document.getElementById("demo").innerHTML = y);
</script>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The issue is that the fetch method needs a proper resource path, example:

fetch("cdn.example.org/files/fetch_info.txt")

Replace cdn.example.org/files/fetch_info.txt with the path of your file, in your case it would most likely be on localhost!

Read more about the fetch method on mdn

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda