首页 > 代码库 > ASP.NET MVC 动态加载 *.ascx

ASP.NET MVC 动态加载 *.ascx

Controller中:


        public ActionResult LoadFoo()
        {
             return PartialView("Foo", aModel);
        }

Javascript:

    function loadFoo() {
        $.ajax({
            url: "LoadFoo",
            success: function(data) {
                $(‘#div‘).html(data);
            },
            error: function() {
                $(‘#div‘).html(‘Failed to load Foo.‘);
            }
        });
    }