Visualize: Embed report

Visualize: Embed report

HTML

<!--Provide visualize.js from your jasperreport server-->
<script src='http://localhost:8080/jasperserver-pro/client/visualize.js'></script>

<!--Provide container to render your visualization-->
<div id='description'>


</div>
<div id="container"></div>

CSS

#container {
    border: 1px solid black;
}

JavaScript

visualize({
    auth: {
        name: "superuser",
        password: "superuser"
    }//this part for user able login 
}, function (v) {

    
    var report = v.report({ //this function for embed report into container
        resource: "/public/SIMS/Dashboard/Staff_and_Facilities/Percentage_Attendance", //report path
        error: handleError, //function that will executed if we will have any error 
        success:function(data){  //this function will executed if all ok and returned data
        
        $("#description").append("<p> <b>Report</b>: 01._Geographic_Results_by_Segment_Report </p>");
       
           
        
       	
          
        },
        container: "#container" //css location of container for ember report
    });
    
   
    
    
   
    
    function handleError(err) {
        alert(err.message); //show error in alert
    }

});