Skip to content

Instantly share code, notes, and snippets.

@lydonchandra
Created May 21, 2013 01:28
Show Gist options
  • Save lydonchandra/5616947 to your computer and use it in GitHub Desktop.
Save lydonchandra/5616947 to your computer and use it in GitHub Desktop.
Parent-window.html
this.$el.append('<iframe id="iframeDocument" src="/Iframe.html"></iframe>');
loadIframe = function() {
var $iframeDocument = $('#iframeDocument').get(0).contentWindow.document;
$('#iframeContent', $iframeDocument).append( myHtml );
}
Iframe.html
<!DOCTYPE html>
<html>
<head>
<title>Info List</title>
<script type="text/javascript">
var $ = parent.window.$;
if( ! $ ) {
alert('Error! jQuery does not exist');
}
function callParentWindow( arg1 ) {
// Call info1Jump in the main window
parent.window.func1( arg1 );
$('div#content', parent.window.document).dialog('close');
return false;
}
window.onload = function() {
parent.window.loadIframe();
}
</script>
</head>
<body>
<div id="iframeContent">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment