Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!