I usually keep a separate .js file in my templates where I set such
javascript variables (preferrably as a hash or module). You can directly
include it in the base.html template so you don't make 2 requests out of it.
The main javascript functionality should definitely go to the static
files though.
On 05/03/13 06:23, [email protected] wrote:
Yes, Thankyou for helping me clean up my line of questioning, That is
exactly what I want to know, can I use the {{ }} tags to do this, and
can they be placed in a seperate .js file.
On Monday, March 4, 2013 1:50:39 PM UTC-5, Gabriel wrote:
If I understood it right, I think it would be enough to serve the
javascript with the initialization
value hardcoded in it, right? Like using {{ }} tags.
Is there a way to do this if there's a separate .js file?
- Gabriel
On Mon, Mar 4, 2013 at 1:41 PM, Shawn Milochik <[email protected]
<javascript:>> wrote:
Probably consume the view with AJAX, doing a POST on the
change event
of the slider.
http://api.jquery.com/category/ajax/
<http://api.jquery.com/category/ajax/>
Put your result in a dictionary within your view and return it
as JSON:
return HttpResponse(json.dumps(result),
mimetype="application/json")
--
You received this message because you are subscribed to the
Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected]
<javascript:>.
To post to this group, send email to
[email protected] <javascript:>.
Visit this group at
http://groups.google.com/group/django-users?hl=en
<http://groups.google.com/group/django-users?hl=en>.
For more options, visit
https://groups.google.com/groups/opt_out
<https://groups.google.com/groups/opt_out>.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.