In my MVC 5 app, in the Home controller's Index() action I'm reading a value from a Web.config variable:
public ActionResult Index()
{
var environment = System.Configuration.ConfigurationManager.AppSettings["Environment"];
...
}
I need to pass that value onto a JavaScript function, which runs when Home/Index.cshtml is rendered:
$(document).ready(function () {
if environment == "External" - pseudo code
$("#AccessInstanceListItem").hide();
});
How can I accomplish this?
P.S. Ideally, I would like to pass this value to a script, which runs when_layout.cshtml is rendered, but I do not have any controllers associated with the layout view.