当我使用 Visual Studio 运行时,以下代码可以正常工作:
$.get('@Url.Content("Content/templates/new_story.htm")', function (tr) {
$("#table_body").append(tr.replace(/#story/g, storyNumber));
});
但是,当我在 IIS 7.5 中发布时,新的 HTML 不会加载到 #table_body
中。
为什么?
最佳答案
当我发布到虚拟目录时,我看到了这一点。我认为您需要做的就是在您的网址中添加一个 tilda:
$.get('@Url.Content("~/Content/templates/new_story.htm")', function (tr) {
$("#table_body").append(tr.replace(/#story/g, storyNumber));
});
关于jquery - $.get 在我的服务器上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15529783/