使用AJAX渲染ASP.NET PartialView不起作用

问题描述 投票:0回答:1

我正在开发ASP.NET MVC Web应用程序。在剃刀(cshtml)网页中,我写了以下超链接:

<a href="#"  onclick="openStudentsRequestsDetail('@Url.Action("StudentRequestsDetail")', @item.RequestId , @item.EsameEstStudente.Id  );" style="display: block; font-size: 10px">@Recognition.Views.Students.Localization.Requests.CorrispondenceNotAutomatic</a>

JavaScript文件已正确引用,并包含以下代码:

var DETAIL_STUDENT_REQUESTS_SELECTOR = "#lookup_student_requests_detail";

$(document).ready(function () {
   // Set ad_lookup_detail as dialog
   recognitionDialog(DETAIL_STUDENT_REQUESTS_SELECTOR);
   registerAjaxTooltip(DETAIL_STUDENT_REQUESTS_SELECTOR);
});

function openStudentsRequestsDetail(controllerActionURL, RequestId , EsameEstId) {


   showLoading();

   getStudentRequestsDetail(controllerActionURL, RequestId, EsameEstId);

}

function closeStudentsRequestsLookup() {
   $(DETAIL_STUDENT_REQUESTS_SELECTOR).dialog('close');
}


function getStudentRequestsDetail(controllerActionURL, pRequestId, pEsameEstId)
{

    ajaxPost(controllerActionURL, { EsameEstStudenteId: pEsameEstId, RichiestaAutorizzId: pRequestId }, function (data)
    {

    $(DETAIL_STUDENT_REQUESTS_SELECTOR).html(data);
    hideLoading();
    openDialog(DETAIL_STUDENT_REQUESTS_SELECTOR,true;

    }, null);

}

我在断点处插入了断点

$(DETAIL_STUDENT_REQUESTS_SELECTOR).html(data)

并且数据包含正确的HTML代码。

但是,不显示该页面。

您能帮我吗?

谢谢,西蒙妮

javascript c# ajax asp.net-mvc asp.net-ajax
1个回答
1
投票

您能否分享完整的标记代码。您共享的代码不包含ID为“ #lookup_student_requests_detail”的元素]

© www.soinside.com 2019 - 2024. All rights reserved.