What is the best way to enter configuration parameters in Javascript in an MVC application?

What is the best way to enter configuration parameters in Javascript in an MVC application? I have seen this done using ASP.NET web forms, but am not sure how to do this with MVC.

@using System.Configuration ... var checkTimer = @ConfigurationManager.AppSettings["CheckTimer"]; 

In Web.config:

 <appSettings> <!-- Polling timer to check for alerts --> <add key="CheckTimer" value="10000"/> </appSettings> 

But in my processed output, I get the following:

 var checkTimer = ; 
+7
source share
3 answers
 var checkTimer = @Html.Raw(Json.Encode(ConfigurationManager.AppSettings["CheckTimer"])); 
+7
source
0
source

If this is not too strange, you can have a hidden variable and then access it in javascript.

0
source

All Articles