I am trying to set a JavaScript variable from a model variable using Razor, and can\'t figure out what is wrong. In the CSHTML page, I\'ve tried the following ways:
If you need to set a variable to a string literal, then it needs to be enclosed in quotes. For example:
<script> var test1 = '@Model.testVariable'; </script>