Quote:
but stuck how to display a partial view using jquery.
Here's one way to do it:
First, define a
div
element.
<div id="divContainer"></div>
The
div
will serve as the container for your
PartialView
.
Now, in your
jQuery
code, you can load your
PartialView
to that container like this:
$("#divContainer").load("@(Url.Action("YourPartialViewActionName","YourControllerName", new { id = TheIDParameterValueThatYouWantToPassInYourAction }))");
Alternatively, you can use the jQuery
.html()
function to load your
PartialView
just like what is demonstrated here:
https://www.c-sharpcorner.com/UploadFile/d551d3/how-to-load-partial-views-in-Asp-Net-mvc-using-jquery-ajax/