2

How can I load a page or a partial view in the popup window in jQuery? I am using jQuery popup but it is not loading with JavaScript.

1 Answer 1

13

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
    });
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.