开发者

ASP.NET MVC loading partial view in popup

开发者 https://www.devze.com 2023-01-06 02:41 出处:网络
How can I load a page or a partial view in the popup window in jQuery?I am using jQuery popup but it is no开发者_JAVA技巧t loading with JavaScript.To load it into a placeholder:

How can I load a page or a partial view in the popup window in jQuery? I am using jQuery popup but it is no开发者_JAVA技巧t loading with JavaScript.


To load it into a placeholder:

$("#idOfPartialViewContainerOnPage").load("/ControllerName/PartialViewName");

Where the Action looks something like:

public ActionResult PartialViewName() 
{
    return PartialView(GetModelForMyPartialView());
}

To make it a popup window, use something like jQuery UI dialog:

var ph = $("#idOfPartialViewContainerOnPage");
ph.load("/ControllerName/PartialViewName", function() { 
    ph.dialog({
        // set dialog options here
    });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消