Using assignVar
and getVar
(Bigcommerce Handlebars helpers) I'm trying to create and insert a javascript variable like so:
<script>var exampleVar = "string";</script>
{{ assignVar "exampleVar" exampleVar}}
The result when using {{ getVar"exampleVar" }}
is that it throws a "not a string error".
I tried {{ assignVar "exampleVar" "exampleVar"}}
which outputs "exampleVar" (minus the quotes). I would like it to output "string" (minus the quotes).
Any thoughts?
You can't. Handlebars is already compiled in the server before it reaches the front end side. If the logic is done in javascript, then you should display the result via javascript too.