I am coding a MVC 5 internet application and I have a question in regards to a View.
I have a ViewModel variable that holds a decimal value. When the View is displayed, I need to get this decimal value and store it in a javascript function.
Here is my Javascript code:
$(document).ready(function () {
var valueToStore = 29;
}
I know that I can make an Ajax call to a controller to retrieve and store this value, but can I get and store this value when the View loads, and the ViewModel has this value?
Thanks in advance.
var myVariable = '@Model.MyDecimal';