我正在开发一个使用Bootstrap v3的新MVC项目。
通过NuGet,我得到了最新版本的jQuery:
Install-Package jQuery
然后我将jQuery(尝试缩小和未缩小)拖到页面上,如下所示:
<!-- JS -->
<script src="~/Scripts/jquery-2.0.3.js"></script>
<script src="~/Scripts/easing.js"></script>
<script src="~/Scripts/bootstrap.js"></script>
<script src="~/Scripts/ddlevelsmenu.js"></script>
<script src="~/Scripts/flexslider.js"></script>
<script src="~/Scripts/jquery.prettyPhoto.js"></script>
<script src="~/Scripts/custom.js"></script>
@RenderSection("scripts", required: false)
</body>
</html>
当我运行我的应用程序时,我得到了jQuery的以下奇怪路径,我无法弄清楚原因!
非常感谢任何帮助。
答案 0 :(得分:-1)
路径无效“... / home /〜/ Scripts / ...”,它必须是“... / Scripts /..."
用以下代码更改代码:
<script src="/Scripts/jquery-2.0.3.js"></script>
<script src="/Scripts/easing.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/ddlevelsmenu.js"></script>
<script src="/Scripts/flexslider.js"></script>
<script src="/Scripts/jquery.prettyPhoto.js"></script>
<script src="/Scripts/custom.js"></script>
或者如果你想要一个绝对路径:
<script src="@Url.Content("~/Scripts/jquery-2.0.3.js")"></script>
<script src="@Url.Content("~/Scripts/easing.js")"></script>
<script src="@Url.Content("~/Scripts/bootstrap.js")"></script>
<script src="@Url.Content("~/Scripts/ddlevelsmenu.js")"></script>
<script src="@Url.Content("~/Scripts/flexslider.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.prettyPhoto.js")"></script>
<script src="@Url.Content("~/Scripts/custom.js")"></script>