I am doing a flask project, and I am trying to call a list from flask and use a for loop to process the list in javascript. However, this does not seem to work.
for (var i = 0; i < 2; i++) {
L.marker(["{{location[i][0]}}", "{{location[i][1]}}"], {
icon: L.mapquest.icons.marker(),
}).bindPopup("restaurant").addTo(map);
}
If I change ["{{location[i][0]}}", "{{location[i][1]}}"] to ["{{location[0][0]}}", "{{location[0][1]}}"], this code will work. I am wondering if there is any special rule when using the javascript variable to call a list in flask. Please let me know if I should provide any other code. Thank you in advance!