Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc Ajax调用无限循环_Asp.net Mvc - Fatal编程技术网

Asp.net mvc Ajax调用无限循环

Asp.net mvc Ajax调用无限循环,asp.net-mvc,Asp.net Mvc,您好,我是MVC新手,所以需要一些帮助。我正在对渲染部分视图进行异步调用,但一旦调用视图,它就会进入infinte循环。有人能帮忙吗 <div class="headings"> <span><a href="#"> <img src="@Url.Content("~/Content/images/icons/Edit.png")" alt="Edit" /></a></span> <p

您好,我是MVC新手,所以需要一些帮助。我正在对渲染部分视图进行异步调用,但一旦调用视图,它就会进入infinte循环。有人能帮忙吗

<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>

@型号.名称

$.ajax({ 类型:“POST”, url:'@url.Action(“FetchAllSubSections”,“Contacts”), 数据:{sectionId:@(Model.sectionId)}, 成功:函数(r){$(“#subsection@(Model.SectionId)”).html(r);}, 错误:函数(ret){ } });
这就是所谓的局部视图(这是另一个局部视图)


@foreach(Model.ContactDetailSections中的var部分)
{
@Html.Partial(“~/Views/Contacts/Details/SectionDetail.cshtml”,section)
}
更改

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


您希望在什么基础上调用
$.ajax
url: '@Url.Action("FetchAllSubSections","Contacts")'
url: 'Contacts/FetchAllSubSections'