Visualize: Embed report
Visualize: Embed report
by juliia13
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="container"></div>
CSS
#container {
border: 1px solid black;
}
JavaScript
visualize({
auth: {
name: "jasperadmin",
password: "jasperadmin"
}//this part for user able login
}, function (v) {
var report = v.report({ //this function for embed report into container
resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report", //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
console.log(data); //write error in console
},
container: "#container" //css location of container for ember report
});
function handleError(err) {
alert(err.message); //show error in alert
}
});