So, I’m making a small application, but I ran into a problem. Basically, I have a page which consists of header and an iframe. Application itself runs in the iframe, while header stays the same, but here’s the thing. Header displays some data from database which is updated from the application. In order for data in the header to stay up to date, I need to refresh it on button click from iframe. So my question is – is it possible? Is it possible to reload a div element in parent page from iframe?
All I have fro now is this jQuery:
var auto_refresh = setInterval(function()
$('#stats').load('reload.php');
}, 5000);
Which reloads my div every 5 seconds, but I don’t know if it’s a good idea to reload a div automatically after a period of time. Well, I hope you guys understand my problem. 🙂
You can access the parent window (=main window) from the iframe, not a problem.
myFrame.htm:
If you want, you can do ajax requests and everything else you need, as long as the some origin policy is not violated (domains, ports & protocols must match).