How to do an action when iframe is generated and l

2019-04-11 14:07发布

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

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.

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

1条回答
Rolldiameter
2楼-- · 2019-04-11 14:29

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

window.parent.document

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 $.

To find in the parent of the iFrame use:

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

how to access iFrame parent page using jquery?

查看更多
登录 后发表回答