I am passing a list of name subject in my HTML template from views.py but it's not working the way its working when I pass a list statically.
Also, It's by default converting into Unicode (that I don't want)
Following is my code,
var data = "{{subject}}";
console.log("data before for loop",data)
var i;
for (i = 0; i<data.length; i++)
{
data = data.replace("'", "'");
}
console.log("data after for loop",data)
var t2 = ['IT', 'Maths', 'History', 'Civics', 'Virtualization', 'BIO', 'EH', 'Chemistry'];
console.log(typeof data);
console.log(typeof t2)
and following is the output of console.log,
data before for loop ['IT', 'Maths', 'History', 'Civics', 'VWE', 'BIO', 'EH', 'EHas']
data after for loop ['IT', 'Maths', 'History', 'Civics', 'VWE', 'BIO', 'EH', 'EHas']
string
object
I want to know why it's not working.. and how can I make it work..
Thanks.