使用 jQuery .load() 函数渲染局部视图

Render Partial View using jQuery .load() function

我有一个项目,当我插入一些东西时,我只想刷新局部视图或 table。当我单击按钮插入时,它会插入但不会加载 table,table 只会显示为空

查看:

@model ClinicManagemet.Models.Assessment

@{
ViewBag.Title = "Update Assessment";
}
<script src="~/Scripts/jquery-3.1.1.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
<h2>Assessment</h2>
<script>
    $(document).ready(function () {
        $('#btn-disease').click(function () {
            var diseaseID = $('#DiseaseID').val();
            var assessmentID = $('#AssessmentID').val();
            var urll = '/DiseaseLists/_DiseaseList?id=' + assessmentID;
            $.ajax({
                type: "POST",
                dataType: "Json",
                data: {
                    'diseaseID': diseaseID,
                    'assessmentID': assessmentID
                },
                url: '@Url.Action("CreateDisease", "DiseaseLists")',
                success: function (f) {
                    $('#tbl-disease').load(urll);
                    alert(f);
                }
            })
        })
    })
</script>
@Html.HiddenFor(model => model.AssessmentID)
<div class="form-group">
    @Html.LabelFor(model => model.DiseaseID, "DiseaseID", htmlAttributes: new { @class = "control-label col-md-2" })

    <div class="col-md-10">
        @Html.DropDownList("DiseaseID", null, htmlAttributes: new { @class = "form-control" })
        @Html.ValidationMessageFor(model => model.DiseaseID, "", new { @class = "text-danger" })
    </div>
</div>
<div class="form-group">
    <div class="col-md-offset-2 col-md-10">
        <input type="submit" id="btn-disease" value="Add" />
    </div>
</div>
<div class="form-group">
    <div class="col-md-offset-2W col-md-10">
        <div id="tbl-disease">
            @{
                Html.RenderAction("_DiseaseList", "DiseaseLists", new { Model.AssessmentID });
            }
        </div>
    </div>
</div>

部分视图控制器:

public ActionResult _DiseaseList(int? assessmentID)
    {
        var diseaseLists = db.DiseaseLists.Include(d => d.Assessment).Include(d => d.Disease).Where(d => d.AssessmentID == assessmentID);
        return PartialView(diseaseLists.ToList());
    }

正如 Curiousdev 在评论中所说,我只是在 jquery

中更改了一些代码
$('#tbl-disease').load( '@Url.Action("_DiseaseList", "DiseaseLists",new {assessmentID = assessmentID})' );