Render Partial View Using jQuery in ASP.NET MVC

后端 未结 8 2074
有刺的猬
有刺的猬 2020-11-22 11:13

How do I render the partial view using jquery?

We can render the partial View like this:

<% Html.RenderPartial(\"UserDetails\"); %>
         


        
8条回答
  •  遇见更好的自我
    2020-11-22 11:40

    Using standard Ajax call to achieve same result

            $.ajax({
                url: '@Url.Action("_SearchStudents")?NationalId=' + $('#NationalId').val(),
                type: 'GET',
                error: function (xhr) {
                    alert('Error: ' + xhr.statusText);
    
                },
                success: function (result) {
    
                    $('#divSearchResult').html(result);
                }
            });
    
    
    
    
    public ActionResult _SearchStudents(string NationalId)
            {
    
               //.......
    
                return PartialView("_SearchStudents", model);
            }
    

提交回复
热议问题