2013-02-16 135 views
0

喜是新來的MVC所以需要一些help.I想提出一個異步調用渲染的局部視圖但只要觀點被稱爲進入一個infinte循環。誰能幫忙?Ajax調用無限循環

<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="[email protected](Model.SectionId)"></div> 

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

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

</script> 

而這正是這部分觀點被稱爲(這是另一個局部視圖)

<div> 

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

你想要什麼樣的基礎調用'$ .ajax'? – 2013-02-18 05:10:19

回答

1

變化

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

url: 'Contacts/FetchAllSubSections' 
+0

Thx很多。有效 – 2013-02-18 09:23:19