插入对 jquery 的引用时页面保持加载

Page keeps loading when inserting reference to jquery

我真的觉得这是一个愚蠢的问题,但我想不通: 这是我的 cshtml 文件,它呈现得很好:

@model CrashTestScheduler.Entity.Model.Channel
@{
    string editFormat = string.Format("<button type='button' class='editForm' data-val-id=\"{0}\"><span class='ico-edit'></span></button>", ".Id");
    const string DeleteFormat = "<button type='button' class='awe-btn' onclick=\"awe.open('deleteChannel', { params:{ id: .Id } })\"><span class='ico-del'></span></button>";
    const string EditFormat = "<button type='button' class='awe-btn' onclick=\"awe.open('editChannel', { params:{ id: .Id } })\"><span class='ico-edit'></span></button>";

}

<script>
    $(function() {
        awe.popup = bootstrapPopup;
    });

    var getChannelGroupNameHandler = function (item) {
        if (item.ChannelGroupName == null || item.ChannelGroupName=='') {
            item.ChannelGroupName = $("#ChannelGroupId option:selected").text();
        }
    }

</script>

<div id="wrap">

    <div id="page-heading">
        <ol class="breadcrumb">
            <li><a href="/Home/index">Home</a></li>
            <li class="active">Channels</li>
            <li style="display:none;"></li>
        </ol>
    </div>

    <div class="container">

        <div class="col-md-12" id="gridRowChannels">

            <div class="col-md-12">
                <div class="panel panel-midnightblue-header">
                    <div class="panel-heading">
                        <h3>Channel List</h3>
                        <div class="options">

                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="row-sub">
                            <button type="button" id="btnAddProject" class="btn btn-primary" onclick="awe.open('createChannel')">
                                Add Channel
                            </button>
                        </div>
                        <div class="row-sub">
                            @Html.Awe().InitPopupForm().Name("createChannel").Url(Url.Action("Create", "ChannelsGrid")).Success("itemCreated('ChannelsGrid',getChannelGroupNameHandler)").OkText("Add").Title("Add Channel")
                        </div>
                        <div class="row-sub">
                           @Html.Awe().InitPopupForm().Name("deleteChannel").Url(Url.Action("Delete", "ChannelsGrid")).Success("itemDeleted('ChannelsGrid')").Parameter("gridId", "ChannelsGrid").Height(200).Modal(true).Title("Delete Channel").OkText("Delete")
                        </div>
                        <div class="row-sub">
                            @Html.Awe().InitPopupForm().Name("editChannel").Group("Channel").Url(Url.Action("Edit", "ChannelsGrid")).Success("itemUpdated('ChannelsGrid',getChannelGroupNameHandler)").OkText("Save").Title("Edit Channel")
                        </div>


    <div class="row-sub">


        @(Html.Awe().Grid("ChannelsGrid")
              .Url(Url.Action("GetItems", "ChannelsGrid"))
              .Columns(
                  new Column {Name = "Name", Header = "Channel Name", Sort = Sort.Asc},
                  new Column {Name = "ChannelGroup.Name", Header = "Channel Group", ClientFormat = ".ChannelGroupName"},
                  new Column {ClientFormat = DeleteFormat, Width = 50},
                  new Column {ClientFormat = EditFormat, Width = 50}

              )

              .Sortable(true)
              .SingleColumnSort(true)
              .LoadOnParentChange(false)
              .PageSize(20)
              .Groupable(false))

    </div>


                    </div>
                </div>
            </div>
        </div>



        <div class="col-md-12" id="pnlEditproject" style="display: none;">
        </div>
    </div>
</div>

但我想使用 jquery 稍后使用 jquery 验证。所以在这里我将它们插入到文件中。

<script src="~/Scripts/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.validate.min.js"></script>

现在无法呈现文件,页面一直在加载和加载。有什么线索吗?

看起来您已经可以访问此页面中的 jQuery 库,因为您正在使用...

$(function() {
        awe.popup = bootstrapPopup;
    });

请删除新引用并尝试查看页面源代码以找出已经可用的库列表。