'consoling out django context in console
why am I getting output in console as {{request.num}} without the actual number?
This is my code:
def test(request):
number = 4
context = {"num": number}
javascript
var number = "{{request.num}}";
console.log(number)
Solution 1:[1]
What worked for me is when I explicitly created the exact js variable inside a script tag in the template and consoled it out from the external js file, seems to work! Don't exactly know why that's happening but is.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | betty_ |
