Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTetsuya Yokoyama
11,286 PointsThe path from widget.js.....??? (Quick question)
Why is Dave using "data/employees.json" to access the file employees.json from widget.js?? Shouldn't it be "../data/employees/json" to access from widget.js? or do we have to use the path from index.html(which widget.js is linked in) Thanks in advance :)
1 Answer
Lachlan Stevens
10,779 PointsThe path for a GET
request is relative to the file that is making the request
While the function being called is defined in js/widget.js
, it is index.html
making the request, and thus the path is relative to this.
Tetsuya Yokoyama
11,286 PointsTetsuya Yokoyama
11,286 PointsThank you very much that explains clearly!!
JASON LEE
17,352 PointsJASON LEE
17,352 PointsI had the exact same question. Thanks!