sdotslezek
sdotslezek

Reputation: 483

Django + Jquery

I am trying to use jquery with my django application and it is having no effect. I have installed jquery using

pip install django-staticfiles-jquery

This successfully installed. I then added jquery to my INSTALLED_APPS. In my project, I have

{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="{% static 'twitterclone/styletwo.css' %}"/>
    <script type="text/javascript" src="{% static 'twitterclone/scriptwo.j' %}"></script>
</head>

For some reason, this successfully loads and uses the css file, but does not use the jquery file. Can anyone help? I have seen others say that using google-hosted servers (AJAX?) is an alternative, but I would rather not have to do so.

Upvotes: 0

Views: 217

Answers (1)

MisterRios
MisterRios

Reputation: 315

Just something I noticed, on your script src tag, you might have forgotten an 's', since most javascript files end with ".js"

<script type="text/javascript" src="{% static 'twitterclone/scriptwo.j' %}"></script>

to:

<script type="text/javascript" src="{% static 'twitterclone/scriptwo.js' %}"></script>

Upvotes: 3

Related Questions