简体   繁体   中英

How do I load the content from a jsp page into a modal window using jQuery?

I am trying to find the best implementation for this situation. I want load the content from a jsp page to a popup window, I tried to use SimpleModal but this library doesn't work with a jsp page, now I'm trying to use a Dialog from JQuery UI. However, this also doesn't work.

Here is my code below:

function loadPage() {    
    $("#loaderPage").load("test1.jsp");
    $("#loaderPage").dialog({
        height: 600, 
        width: 600, 
        modal: true
    }); 
    return false;
}

I'm not getting an error, but I'm also not getting a dialog to popup. What can be wrong and how I can resolve my problem?

JSP pages send regular HTML to the browser, so it doesn't matter if it is a JSP page or any other kind of server side technology that is generating the page that you are calling.

Make sure that the relative path to the "test.jsp" page is the same as the the page where the script is included.

Also make sure that there is an element, such as a div, that has an id attribute that is equal to "loaderPage".

Make sure you include the jquery and jquery-ui libraries as Arun Killu mentioned in his comment.

Also, it may make sense to use an iframe. See this:

How to dynamically load content from an external url, inside of a jquery ui modal dialog widget?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM