You will probably want to open a new controller that can return your partial content. For example:.
public class TemplateController : Controller { public PartialViewResult Get(string name) { return PartialView(name); } }
With this and the route:
routes.MapRoute("Templates", "templates/{name}", new { controller = "Template", action = "Get" });
Then I can call from the client (in this example I am using jQuery):
var model = { name: "Matt" }; $.ajax({ url: "/templates/person", success: function(r) { var html = Mustache.render(r, model); $("body").append(html); } });
Matthew abbott
source share