1
You confused the server-side code with client-side code
For example,
the server-side code
from django.shortcut import render_to_response
name_map_handler(request, **kwargs):
"""
some code to handler the ajax request
"""
render_to_response('the_template_you_want_to_use.html', {'LANGEAGE_CODES': ['zh-hans', 'de'])
only the server-side variable that you decide to render can be use in the Django template. Just like the LANGAGE_CODES
in my example.
Source:stackexchange.com