Jump to content
JasperReports Library 7.0 is now available ×

visualize.js error when report called through a web page.


mat001
Go to solution Solved by hozawa,

Recommended Posts

I am createing a test web page that will retrieve a report using visualize.js and displays it in a div. When I run the code in JSFiddle it works fine. But when I load it as a web page the report would not load, the browser console window displays:
TypeError: t is null
...ion h(e){var t=e.toLowerCase().match(j),i=t[2],n=t[3],r=t[4]||"";return("http:"=...


An error gets tirggered when the page is loaded through a web page (both Firefox & ie triggers the same message); but not when executed through JSFiddle, the reports loads successfully, huh!!!  Please see the code below for .html & JSFiddle. Hope I provided enough info. Thanks for your help in advance!

.HTML code:
<html>
<head>
   <meta charset='utf-8'>
   <script src="http://localhost:8080/jasperserver-pro/client/visualize.js" type="text/javascript"></script>
   <title>jRxCONNECT</title>
</head>
<body>
    <div id="container" style="border: 0px #eee solid; min-height: 5px; min-width: 100px; background: #fff; padding: 0px; "> </div>
    <script>
        try{
            visualize({
                auth:{
                    name: "xxxxx",
                    password: "xxxxx"
                }
            }, function (v){
                report = v.report({
                    resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report",
                    container: "#container",
                    params: {"parProductId":["34"]},
                    error:function(err){
                        alert("Rep Err: " + err.message);
                    }
                }
                );
            }, function (v){
                alert("err");
            }, function (v){
            }
            );
        }catch (ex){
            alert(ex.toString());
        }
    </script>     
</body>
</html>




JSFiddle Code:
JSFiddle HTML Code:

<script src="http://localhost:8080/jasperserver-pro/client/visualize.js" type="text/javascript"></script>
<div id="container" style="border: 0px #eee solid; min-height: 5px; min-width: 100px; background: #fff; padding: 0px; "></div>

JSFiddle Javascript Code:
try{
    visualize({
        auth:{
            name: "xxxxx",
            password: "xxxxx"
        }
    }, function (v){
        report = v.report({
            resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report",
            container: "#container",
            params: {"parProductId":["34"]},
            error:function(err){
                alert("Rep Err: " + err.message);
            }
        }
        );
    }, function (v){
        alert("err");
    }, function (v){
    }
    );
}catch (ex){
    alert(ex.toString());
}




 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...