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 trial
Dekin O'Sullivan
10,749 PointsLinking widget.js to index.html: why use "script"?
Hi,
In the following video: https://teamtreehouse.com/library/ajax-basics/programming-ajax/parsing-json-data, why is Dave using the "script" method to link the widget.js file to index.html ? I mean, why not use the "link" method like for all the other files? (stylesheet, etc.) And, what is exactly the "script" method btw?...
Many thanks
2 Answers
Ashlee Brown
8,045 PointsJavaScript files are script files, so in HTML they're linked via the script tag. For a more in-depth explanation, check out this answer on Stack Overflow.
Dekin O'Sullivan
10,749 PointsMany thanks for your answer Ashlee. However, you replied as a "comment" and not an "answer". This means I cannot "upvote" your answer (which would give you points and all). If you want you can repost your comment as an answer and I will upvote it. Thanks again.