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

172
Visualizações
How to execute fetch paths without interfering with webpage pathname?

I am working on a Django project and got stuck on url patterns and routes.

On index.html, the pathname is "" and the JS functions are working great. The fetch url tweets/${tweetid} is matching with Django API route url pattern tweets/<int:tweetid> and is working fine.

However, on profile.html, the pathname is "profile/<int:userid>" and JS is not working here. The fetch url tweets/${tweetid} results the final path profile/tweets/<int:tweetid>. Since that is not in urls.py, I am getting an error.

How can I execute my fetch and JS functions on any html page in this web application?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You should start the path with a leading slash (/) to use an absolute path, not a relative path, so:

/tweets/${tweetid}

The leading slash means that it will for example fetch the page hostname.ext/tweets/1234. If you use a relative path (without a leading slash), the item will be appended to the already specified path.

over 4 years ago · Santiago Trujillo 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