Cannot reach reach jQuery (in parent document ) from IFRAME
- by Michael Joyner
I have written a backup program for SugarCRM. My program sets a iframe to src=BACKUP.PHP
My backup program sends updates to parent window with:
echo "<script type='text/javascript'>parent.document.getElementById('file_size').value='".fileSize2human(filesize($_SESSION['archive_file_name']))."';parent.document.getElementById('file_count').value=".$_SESSION['archive_file_count'].";parent.document.getElementById('description').innerHTML += '".$log_entry."\\r\\n';parent.document.getElementById('description').scrollTop = parent.document.getElementById('description').scrollHeight;</script>";
echo str_repeat( ' ', 4096);
flush();
ob_flush();
I have added a JQUERY UI PROGRESS BAR and I need to know how I update the progress bar on the parent window.
I tried this:
$percent_complete = $_SESSION['archive_file_count'] / $_SESSION['archive_total_files'];
echo "<script type='text/javascript'>parent.document.jquery('#progressbar').animate_progressbar($percent_complete);
</script>";
......... and get this error in browser.
Uncaught TypeError: Object [object HTMLDocument] has no method 'jquery'
HOW CAN I UPDATE THE PROGRESS BAR IN PARENT DOCUMENT FROM THE IFRAME?