I have a div on an ASP.NET MVC page that I would like to dynamically populate (at the request of the user) using jQuery. I currently have jQuery placing a JSON call for my controller that returns a JSON object, and then I use Javascript to assemble the HTML manually, which is then placed in a div.
Wait a minute. Wouldn't it be much simpler to get the controller to create HTML on its own (using its own control (.ascx file)) and then just return the line to be placed in the div?
Lighter, generously!
My current attempt includes the following javascript:
$('#MyDiv').load("/MyController/GetList");
calling the following controller method:
public PartialViewResult GetList()
{
... create model ...
var result = PartialView("CategoryList", model);
return result;
}
, . ( ), Firebug Net ( Firebug Console ).
, Debug.Print .ascx , jQuery PartialView .
PartialView ( PartialViewResult), ?
.
, ... .