[Answer]-Accessing Django dictionary in Javascript

1👍

You can do both.

Option 1:
Provide the script via a template that will send the code with the values. Will look ugly but work. Your javascript file or even the html must be parsed by the django template engine. They can’t be static

Option 2:
Provide a new view with a json response, that is accessed from your javascript code (ie: via JQuery)

👤Alvaro

Leave a comment