c# - Calling global variables in the AppSettings from a Javascript function -
In my javascript function I am trying to call my global variable which is currently the web of my ASP.NET project Defined file is defined in What is the syntax for this? I have looked around and nothing seems to work till now. I have tried the following, but I did not find anything about it:
web.config:
& lt; App settings and gt; & Lt; Add Key = "var1" value = "123456" /> & Lt; / AppSettings & gt; default.aspx:
& lt; Script type = "text / javascript" & gt; Function doSomething () {"& lt;% = System.Configuration.ConfigurationManager.AppSettings ['var1']. ToString ();% & gt; }; & Lt; / Script & gt;
What do you expect to receive from him? Even if you manage to get the price, the code does nothing with it. It just announces a string and throws it away ...
You can enter values in the JavaScript variable like this:
Now you can use that variable in your Javascript code.
Comments
Post a Comment