How can I feed a server side Django string array into a client side JavaScript array? -


on server array appears follows:

data = [u'data1', u'data2', u'data3'] 

in django, send data through client using:

render(..., {'data': data}) 

on client side try render in javascript using:

{{data}} 

and get:

[u'data1b', u'data2', u'data3'] 

how can fix encoding issue?

you need safe escape string inorder work fine

{{data|safe|escape}} 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -