在js文件中,获取webconfig中的配置信息

xiaoxiao2021-02-28  150

webconfig中的配置信息

<!--默认押金--> <add key="OverDueMoney" value="80" />

1.在客户端页面(非单独的js文件),可以直接获取webconfig的配置信息

function Name() { var Name=System.Web.Configuration.WebConfigurationManager.AppSettings["OverDueMoney"]; }

2.在单独的js文件中,那该如何调用Webconfig?

2.1在前段页面中,可以直接自定个标签

<input class="easyui-textbox" default-price="0" default-subsidies="0" type="text" default-value="<%=ConfigurationManager.AppSettings.AllKeys.Contains("OverDueMoney")%>" name="OtherPrice" id="OtherPrice" />

2.2在js页面中,通过attr获取属性里面绑定的值

var OverDueMoney = $("#OtherPrice").attr("default-value");
转载请注明原文地址: https://www.6miu.com/read-29915.html

最新回复(0)