use javascript variable in mvc view code example
Example: mvc set javascript variable from model
// Set your c# variables
@model <Your namespace>.MyModel
@{
int myInt = MyModel.myInt;
string myString = MyModel.myString;
}
<script>
//In your js use the razor syntax to call your variables
var myInt = @myInt;
var myString = @myString;
//
var myInt = @MyModel.myInt;
var myString = @MyModel.myString;
</script>