2

我正在开发一个使用 Bootstrap v3 的新 MVC 项目。

通过 NuGet,我得到了最新版本的 jQuery:

安装包 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 路径,我不知道为什么!

jQuery路径错误

4

1 回答 1

-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>
于 2013-10-09T20:51:38.000 回答