Basic Report Embed

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

HTML

<script src="https://mobiledemo.jaspersoft.com/jasperserver-pro/client/visualize.js"></script>

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

CSS

#container {
  width:400px;
}

JavaScript

visualize({
    auth: {
        name: "joeuser",
        password: "joeuser",
        organization: "organization_1"
    }
}, function (v) {

    //render report from provided resource
    v("#container").report({
        resource: "/public/Samples/Reports/States",
        error: handleError
    });

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

});