Render Partial View Using jQuery in ASP.NET MVC

后端 未结 8 2149
有刺的猬
有刺的猬 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条回答
  •  旧时难觅i
    2020-11-22 11:36

    I did it like this.

    $(document).ready(function(){
        $("#yourid").click(function(){
            $(this).load('@Url.Action("Details")');
        });
    });
    

    Details Method:

    public IActionResult Details()
            {
    
                return PartialView("Your Partial View");
            }
    

提交回复
热议问题