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

130
Visualizações
Path problem while Including a js file in several html files which are located in different folders

enter image description here

There are several html files(index.html, somewhere1.html, somewhere2.html...), and they all include same js file(script.js). And the js file(script.js) fetches a json file(data.json). The problem is, when script.js tries to fetch data.json, I cannot use same relative path(./data.json). I know I can use absolute path, but I cannot confirm where the whole folder would be located so absolute path can be changed depending on the situations.

How can I solve this problem?

about 4 years ago · Juan Pablo Isaza
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