I am trying to access C# Static Variable in JavaScript/JQuery in an MVC 4 application. I am able to access it with following syntax.
var currentCulture = '@StaticCache.Culture'; //Returns en-GB
Issue is that once page load I can access correct value but assuming we make one Ajax Call to server and that call (in Controller) change the value for static variable.
StaticCache.Culture="en-US";
Again read same static variable in Java Script (Razor View)
var currentCulture = '@StaticCache.Culture'; //**Still returns en-GB instead of en-US**
It cached the variable somehow. Is there any way I can read the latest value?
Thank you Best Regards.
Session
variable rather, or depending on a couple of things, you can use MVC'sViewBag
. – jacqijvv Feb 24 at 11:16