1

i want to call child iframe function, which is print by jquery html() in child iframe. I.e

<body>
<iframe id="full_website_preview"> 

</iframe>

<script type="text/javascript">
        var iframe = document.getElementById('full_website_preview');
        var iframeContent = (iframe.contentWindow || iframe.contentDocument);

        $.ajax({url: "return_data.php", success: function(result){   //alert(result);
            iframeContent.contents().find('body').html(result); 
        }});

        setTimeout(function() {
                iframeContent.alert_me();
            }, 2000);
</script>

return_data.php

 <p>print test</p>
<script>
function alert_me() { 
    alert('Alert'); } 
</script>

0 Answers0