Basic Dashboard Embed

Simple initialization of the library, plain text authentication and loading a dashboard

by Pavel Savushchyk

HTML

<script src="http://infra-platforms-phase2-4779-vbandaru.pfa.jaspersoft.com:8080/jasperserver-pro/client/visualize.js"></script>

<!-- JQuery - Latest compiled and minified -->
<div id="container"></div>

JavaScript

visualize({
    auth: {
        name: "superuser",
        password: "superuser",
    }
}, function (v) {

    //render report from provided resource
    v("#container").dashboard({
        resource: "/public/Samples/Dashboards/1._Supermart_Dashboard",
        error: handleError,
        container:"#container"
    });

    //show error
    function handleError(err) {
        alert(err.message);
    }
});