Visualise & Iframe - Jasper Report

Uses Visualise to authenticate Iframe to render report

HTML

<script type='text/javascript' src="http://localhost:8081/jasperserver-pro/client/visualize.js"></script>
<div id="embedReportIframe"></div>
<!--<button id="openReport">Open Sample Report</button>-->
<!--<iframe src="http://localhost:8081/jasperserver-pro/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=/public/Samples/Reports&reportUnit=/public/Samples/Reports/SalesByMonthReport&startMonth=6&endMonth=12&decorate=no"></iframe>-->

JavaScript

visualize({
    auth: {
        name: "superuser",
        password: "superuser"
    }
},function (v) {
    alert('Authenticated Successfully');
    
var ifrm = document.createElement('iframe');
ifrm.setAttribute('id', 'jasperReport'); // assign an id
ifrm.frameBorder=0;
ifrm.width="500px";
ifrm.height="500px";
    
document.getElementById('embedReportIframe').appendChild(ifrm);

// assign url
ifrm.setAttribute('src', 'http://localhost:8081/jasperserver-pro/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=/public/Samples/Reports&reportUnit=/public/Samples/Reports/SalesByMonthReport&startMonth=6&endMonth=12&decorate=no');
});