Basic Report Embed

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

by sprilukin

HTML

<img style="display:none" src="https://infra-platforms-phase2-17953-khariyap.pfa.jaspersoft.com/jasperserver-pro/rest/login?j_username=joeuser%7Corganization_1&j_password=joeuser"/>

<script src="https://infra-platforms-phase2-17953-khariyap.pfa.jaspersoft.com/jasperserver-pro/client/visualize.js"></script>

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

CSS

#container {
  width:400px;
}

JavaScript

visualize({
    // If you will comment out whole `auth` property - it still will work
    // because we already authenticated with rest login earlier
    // and previous auth cookie will be sent
    auth: {
      name: "joeuser",
      password: "joeuser",
      organization: "organization_1"
    }
  }, function (v) {
    v("#container").report({
      resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report",
      error: (err) => {
        alert(err.message);
      }
    });
  });