JSFiddle - React, Tailwind, and code Playground

by sprilukin

HTML

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://infra-platforms-phase2-13253-spriluki.pfa.jaspersoft.com/jasperserver-pro/client/visualize.js"></script>
<div id="container"></div>

JavaScript

visualize({
    server: "https://infra-platforms-phase2-13253-spriluki.pfa.jaspersoft.com/jasperserver-pro",
    auth: {
      name: "superuser",
      password: "superuser"
    }
  }, function (v) {
    const report = v.report({
      resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report",
      container: "#container",
      error: function (e) {
        console.log(e);
      },
      success: function (...args) {
        report.export({
          //export options here
          outputFormat: "pdf",
          //exports all pages if not specified
          //pages: "1-2"
        }, function (link) {
          console.log(link.href);
          //var url = link.href ? link.href : link;
          //window.location.href = url;
          jQuery.ajax({
            url: link.href,
            xhrFields: {
              withCredentials: true
            },
            crossDomain: true
          });
        }, function (error) {
          console.log(error);
        });
      }
    });
  });