Saturday, July 30, 2011

jquery

I don't understand how can I use jquery with Django.
I made a template:
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="{{ MEDIA_URL }}js/
jquery-1.6.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
$("<div><p>hello!</p></div>").appendTo("#testid");
</script>
<div id="main">
<div id="testid">
<p>test</p>
</div>
</div>
</body>
</html>

In settings.py file I wrote: MEDIA_URL = '/static/'
There is a 'static/js' folder in my application folder, and it has a
jquery-1.6.1.min.js in it.
This doesn't work. Could anyone help me?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment