How to send php variable from Colorbox iFrame to parent; and how to have a function involving said variable run on parent without reload
I'm a bit new to programming so bear with me here.
I'm trying to have a link clicked from within a Colorbox iFrame (each link on parent page opens different Colorbox based on MySQL variables) execute a function in the parent frame without it having to refresh.
The link clicked in the iFrame is for a song, and I'd like to leave the iFrame untouched (ie not close), though the parent-based player will play the specific song...
Is this possible? Am I 开发者_StackOverflow中文版making it too complicated? Solution?
Any help would be more than appreciated.
You can call javascript functions that are defined in the parent window of the iframe by using
parent.yourFunction();
So you can basically have this in the parent:
function myFunction(songID) {
}
and in the iframe call it like this:
parent.myFunction(songID)
精彩评论