如何使用jQuery将jsp页面中的内容加载到模式窗口中?

时间:2021-12-29 08:33:35

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.

我正在努力为这种情况找到最佳实施方案。我想将内容从jsp页面加载到弹出窗口,我尝试使用SimpleModal但是这个库不能用于jsp页面,现在我正在尝试使用来自JQuery UI的Dialog。但是,这也行不通。

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?

我没有收到错误,但我也没有得到弹出对话框。什么可能是错的,我怎么能解决我的问题?

1 个解决方案

#1


0  

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.

JSP页面将常规HTML发送到浏览器,因此无论是JSP页面还是生成您正在调用的页面的任何其他类型的服务器端技术都无关紧要。

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

确保“test.jsp”页面的相对路径与包含脚本的页面相同。

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

还要确保有一个元素,例如div,其id属性等于“loaderPage”。

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

确保包含jquery和jquery-ui库,如他在评论中提到的Arun Killu。

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

此外,使用iframe可能有意义。看到这个:

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

如何从jquery ui模式对话框小部件中的外部URL动态加载内容?

#1


0  

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.

JSP页面将常规HTML发送到浏览器,因此无论是JSP页面还是生成您正在调用的页面的任何其他类型的服务器端技术都无关紧要。

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

确保“test.jsp”页面的相对路径与包含脚本的页面相同。

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

还要确保有一个元素,例如div,其id属性等于“loaderPage”。

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

确保包含jquery和jquery-ui库,如他在评论中提到的Arun Killu。

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

此外,使用iframe可能有意义。看到这个:

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

如何从jquery ui模式对话框小部件中的外部URL动态加载内容?