是否可以在 ASP.NET MVC4 Razor 项目的 JavaScript 文件中使用 web.config 设置,例如下面的“serverPath”?
<appSettings>
<add key="serverPath" value="http://myserver" />
</appSettings>
我想根据调试或发布模式更改以下 jQuery ajax 调用的 URL
var request = $.ajax({
url: 'http://myserver/api/cases',
type: 'GET',
cache: false,
dataType: 'json'
});
是否可以像 View 一样从 web.config 读取值并将其替换为 .js 文件?