如何在父窗口中显示iframe的动作结果 [英] How to display action result of iframe in parent window

查看:115
本文介绍了如何在父窗口中显示iframe的动作结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML页面。
html页面有一个iframe。
当我在iframe中提交表单时,返回的结果显示在iframe中。
如何在iframe的父级中显示该结果?

I have a html page. html page has a iframe. when I submit the form inside iframe, returned result is displayed inside that iframe. How to display that result in parent of iframe??

推荐答案

   <script type="text/javascript">
        $(document).ready(function () {
            $("#test").load(function (e) {
                var htmlFromServer = $(e.target).contents().find("html").html();
            });
        });
    </script>

  <iframe id="test" src="HTMLPage1.htm"></iframe>

您需要做的就是处理iframe的onload事件。 iframe从服务器收到响应时会触发此事件。

All you need to do is handle the onload event of the iframe. This event is triggered when the iframe receives response from the server.

这篇关于如何在父窗口中显示iframe的动作结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆