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

0

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; ">&nbsp;</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());
}




 

mat001's picture
2
Joined: Oct 23 2014 - 10:54am
Last seen: 4 years 8 months ago

1 Answer:

1

Which OS are you using? Windows8.x have problem with "localhost". Try replacing it with IP address. Also, check if Visualize.js script file is being loaded.

hozawa's picture
44219
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 6 days ago

Using the IP address instead of localhost worked! FYI: OS is Windows7.

mat001 - 4 years 8 months ago
Feedback
randomness