Reputation: 527
I am trying to load the jQuery files to the Django. But its not working for me. When I write the code inside the script
tag inside the Head
it works perfectly. I wrote the code in a file called main.js
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js">
</script>
<link rel="text/javascript" href="{% static 'js/main.js' %}">
This is my static path in settings
STATIC_URL = '/static/'
How can I load the jQuery file in django?
Upvotes: 0
Views: 31
Reputation: 1727
HTML's link
is used to load stylesheet
-- CSS
not JavaScript
file.
You have to load javascript with script
tag.
so like this:
<script src="{% static 'js/main.js %}"></script>
REF: https://developer.mozilla.org/en/docs/Web/HTML/Element/script
Upvotes: 1