0
我需要使用app.config中的值填充变量。有没有办法在JavaScript中做到这一点?这就是我现在所拥有的,但我不相信这是任何方式正确..在Javascript中访问app.config的值
var notConfident = ConfigurationManager.AppSettings["GoogleValue"];
我需要使用app.config中的值填充变量。有没有办法在JavaScript中做到这一点?这就是我现在所拥有的,但我不相信这是任何方式正确..在Javascript中访问app.config的值
var notConfident = ConfigurationManager.AppSettings["GoogleValue"];
没有,JavaScript中的客户端浏览器中运行的应用程序配置为在服务器上的文件。
您可以通过它发送到客户端获取的价值,是这样的:
.aspx文件:
<input type="hidden" id="ikey" runat="server" />
cs文件,网页加载方法:
ikey.InnerText = ConfigurationManager.AppSettings["GoogleValue"];
.js文件,onload方法:
var something = document.getElementById("ikey").value;