snippet-1501184983


Using MVT inside JavaScript

The MVT populates first before the JavaScript runs.
Created: 1501245342
View "Using MVT inside JavaScript"
<!-- Assign our two values --> <mvt:assign name="g.valueOne" value="1" /> <mvt:assign name="g.valueTwo" value="2" /> <!-- We can use mvt with JavaScript because the values are inserted before JavaScript executes --> <script> var test = &mvt:global:valueOne; + &mvt:global:valueTwo;; document.write(test); </script>
 

Snippet: 1501184983 - v3

Created: 1501245245
View "Snippet: 1501184983 - v3"
<!-- Assign our two values --> <mvt:assign name="g.valueOne" value="1" /> <mvt:assign name="g.valueTwo" value="2" /> <!-- We can use mvt with JavaScript because the values are inserted before JavaScript executes --> <script> var test = &mvt:global:valueOne; + &mvt:global:valueTwo;; document.write(test); </script>
 

Test JavaScript mixed with MVT

The MVT entities populate before the script executes allowing use of MVT within the script.
Created: 1501245142
View "Test JavaScript mixed with MVT"
<!-- Assign our two variables --> <mvt:assign name="g.valueOne" value="1" /> <mvt:assign name="g.valueTwo" value="2" /> <!-- We can use mvt with JavaScript because the values are inserted before JavaScript executes --> <script> var test = &mvt:global:valueOne; + &mvt:global:valueTwo; document.write(test) </script>
 

Snippet: 1501184983 - v1

Created: 1501184983
View "Snippet: 1501184983 - v1"
<!-- Assign our two values --> <mvt:assign name="g.valueOne" value="1" /> <mvt:assign name="g.valueTwo" value="2" /> <!-- We can use mvt with JavaScript because the values are inserted before JavaScript executes --> <script> var test = &mvt:global:valueOne; + &mvt:global:valueTwo; document.write(test) </script>