Gabi Barrientos
Gabi Barrientos

Reputation: 1886

django-jquery doesn't seem to be working

I have a server running with Django 1.6 framework. It runs without any problems as far as I can tell, and even django-jquery should be working properly since everything points that way. I am actually able to load jquery.js and my own js file into the browser. When I inspect the code of my website I can click the links to each of the javascript files and SEE the code, but for some reason my code isn't firing.

I am very new to the Django framework, but like I said, as far as I can tell everything on the Django side seems to be working properly.

This is how the links to the js files look in the code in my browser:

<script type='javascript' src='/static/js/jquery.js'></script>
<script type='javascript' src='/static/js/myscript.js'></script>

And I can actually click the links to the scripts and view the code in them so they should be loaded properly. I haven't changed the code in the jquery.js file, it's still the same it was when I installed django-jquery using pip install django-jquery. The code in myscript.js is as follows:

$(document).ready(function() {
    alert('Hello world!');
});

Which seems like it should be working fine as well. I am completely stumped and I have zero clue what I should do to get this to work. It probably is something simple and completely stupid of me to miss, but I have been battling this problem for the past few hours now and I have no idea how to go about this. Any help would very greatly appreciated...

EDIT
Just to be sure the django-jquery supplied code wasn't the problem, I tried to update the code in the current jquery.js file to the latest jquery release code (2.0.3 as of this moment) which didn't change anything.

Upvotes: 0

Views: 1492

Answers (1)

Aamir Rind
Aamir Rind

Reputation: 39659

Change type='javascript' to type='text/javascript'

Upvotes: 2

Related Questions