More educational value out of this question than
a practical one
Is it possible to interpolate a Javascript variable as
to assign it's value to a TT variable?
The scenario would be that from within the materialized
template to extract value pairs from DOM elements like
sliders,select groups etc,serialize them and save the
resulting string into a cookie:
<script>
var getvalue = $(
"#Brand").find(":selected").parent("optgroup").attr("label");
jsvar = {Brand:getvalue};
jsvar = JSON.strignify(jsvar);
[% SET session.ttvar= jsvar ]%
</script>
Imagine going through a series of elements,capturing
the values which can be used later on as parameters to a
POST call i.e
{Brand:...,Price_from....,Price_to:...}
since they would be saved in a cookie which would be valid
for the rest of the session, they could be reused by the
same or another route for purposes of for example
reinstating or remembering the previous state after the back
button of the browser is hit
Of course, that could be done with an Ajax call but been
thinking of alternative ways