Attempting to transfer data from my Django application to JavaScript based on the solutions provided in this question
views.py
context['username'] = json.dumps(request.user.username)
test_script.js
document.write('Script working')
username = {{ username|safe }};
Encountering an error in the console:
Uncaught SyntaxError: Unexpected token '{'
What might be causing this issue?