0

嗨,我是 MVC 的新手,所以需要一些帮助。我正在对渲染部分视图进行异步调用,但是一旦调用视图,它就会进入无限循环。任何人都可以帮忙吗?

<div class="headings">
    <span><a href="#">
        <img src="@Url.Content("~/Content/images/icons/Edit.png")" alt="Edit" /></a></span>
    <p class="floatLeft">
        @Model.Name</p>
</div>
<div class="profilesBlk" id="subSections@(Model.SectionId)"></div>

<script type="text/javascript" language="javascript">

   $.ajax({
        type: "POST",
        url: '@Url.Action("FetchAllSubSections","Contacts")',
        data:{sectionId:@(Model.SectionId)},
        success: function (r) { $("#subSections@(Model.SectionId)").html(r); },
        error: function (ret) {
        }
    });

</script>

这就是这个局部视图被调用的地方(这是另一个局部视图)

<div>

    @foreach (var section in Model.ContactDetailSections)
    {
        @Html.Partial("~/Views/Contacts/Details/SectionDetail.cshtml", section)
    }
    </div>
4

1 回答 1

1

改变

url: '@Url.Action("FetchAllSubSections","Contacts")'

url: 'Contacts/FetchAllSubSections'
于 2013-02-18T05:06:34.027 回答