<div dir="ltr"><div><div><div><div><div><div>More educational value out of this question than a practical one<br><br></div>Is it possible to interpolate a Javascript variable as to assign it's value to a TT variable?<br></div>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:<br></div><br><script><br> var getvalue = $( "#Brand").find(":selected").parent("optgroup").attr("label");<br> jsvar = {Brand:getvalue};<br> jsvar = JSON.strignify(jsvar);<br> [% SET session.ttvar= jsvar  ]%<br></script><br><br></div><div>Imagine going through a series of elements,capturing the values which can be used later on as parameters to a POST call i.e<br><br></div><div>{Brand:...,Price_from....,Price_to:...}<br><br></div>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 <br><br></div>Of course, that could be done with an Ajax call but been thinking of alternative ways <br><br></div>So the problem here is how do you escape out of the TT context and inject temporary Javascript context in  [% SET session.ttvar= jsvar %] ,so that jsvar gets assigned to ttvar <br>?<br><br></div>