Skip to content

Arnab-Developer/PartialViewAspNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Partial view and AJAX call

Demo with partial view and AJAX call using ASP.NET MVC.

Index action method of Product controller returns partial view.

public ActionResult Index()
{
    IList<Product> products = Repositary.GetAll();
    return PartialView(products);
}

This Index method has been called from Home -> Index view with jQuery and placed in html.

$(document).ready(function () {
    $("#ShowProducts").click(function () {
        $.get("/Product/", function (data) { // Get data through AJAX call.
            $("#Products").empty();
            $("#Products").html(data); // Populate with data.
        });
    });
});

About

Demo with partial view and AJAX call using ASP.NET MVC

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published