TL;DR --> can I pass JS var strings into {{ }} to retrieve Python vars from Flask app?
Instead of writing multiple iterations of a JS code block each with only slightly differently named Jinja variables (with similar conventions) like:
 //PTC Color Change
if ({{ptc_precip_probs[1]}} <= 25 && {{ptc_precip_probs[2]}} <= 25) {
    $("#ptc_block").css("background", "#21CE99"); //green
} else {
    $("#ptc_block").css("background", "#F45531"); //red
}
//COL Color Change
if ({{col_precip_probs[1]}} <= 25 && {{col_precip_probs[2]}} <= 25) {
    $("#col_block").css("background", "#21CE99"); //green
} else {
    $("#col_block").css("background", "#F45531"); //red
}enter code here
is it possible to do something like this:
var cities = ["nrg", "rrg", "gsm", "ptc", "col"];
for (var city in cities){
    var block = "."+cities[city]+"_block";
    var precipOne = String(cities[city])+"_precip_probs[1]";
    var precipTwo = String(cities[city])+"_precip_probs[2]";
    if ({{precipOne}} <= 25 && {{precipTwo}} <= 25) {
        $(String(block)).css("background", "#21CE99"); //green
    } else {
        $((block)).css("background", "#F45531"); //red
    }
}
When I attempt to do this exact operation, however I receive a Jinja2 error.
 
    