如何在从jquery动态生成和加载iframe时执行操作 [英] How to do an action when iframe is generated and loaded dynamically from jquery

查看:62
本文介绍了如何在从jquery动态生成和加载iframe时执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站,我使用grails作为我的后端和php作为我的前端和数据类型返回为JSON和Jquery。问题是,当我提交我的表单以定位iframe时,其工作正常并返回true值,但是
是提交from我使用jquery生成iframe

I a developing a site where I am using grails as my backend and php as my frontend and datatypes returns as JSON and Jquery. The issue is when I submit my form to target an iframe its work fine and return true value but yes on submitting the from I generates the iframe using jquery

现在我要做的就是从iframe中获取值并在我的父网页中使用它,并在提交后重置表单并加载iframe如何实现这一点以及如何在此使用jquery事件。 / b>

Now what I have to do is take value out of that iframe and used it in my parent webpage and also to reset the form after submitting and iframe loaded how can I achieve this and how can I use jquery events on this.

在成功发布数据并隐藏iframe成功加载后,我应该使用什么事件在我的页面上生成效果。

What event should I use to generate effects on my page after the data is posted successfully and hidden iframe loaded successfully.

推荐答案

我在Stack Overflow上找到了有关如何使用jQuery访问iFrame父页面的声音帮助。

Searching around I found sound help on Stack Overflow, about how to access iFrame parent page using jQuery.

window.parent.document

jQuery是一个顶级的库JavaScript,而不是它的完全替代品。您不必使用涉及 $ 的内容替换每个最后的JavaScript表达式。

jQuery is a library on top of JavaScript, not a complete replacement for it. You don't have to replace every last JavaScript expression with something involving $.

要在父级中查找iFrame使用:

To find in the parent of the iFrame use:

$('#parentPrice', window.parent.document).html();

如何使用jquery访问iFrame父页面?

这篇关于如何在从jquery动态生成和加载iframe时执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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