I want to render visualize js inside plain HTML, getting below error. Kindly help me to resolve the same.
2 Answers:
Seems like visualize.js script file is not being loaded. First, you are using Commercial version of JasperReport Server aren't you? Visualize.js is not supported in community version.
Try if you can access it by just entering the following from your web browser.
http://127.0.0.1:8080/jasperserver-pro/client/visualize.js
Try deleting the following:
server: "http://127.0.0.1:8080/jasperserver-pro",
Please refer to the following:
<html>
<head>
<script src="http://127.0.0.1:8080/jasperserver-pro/client/visualize.js?_opt=false"></script>
</head>
<body>
<div id="reportContainer">Loading..</div>
<script>
visualize({
//server: "http://127.0.0.1:8080/jasperserver-pro",
auth: {
name: "jasperadmin",
password: "jasperadmin",
organization: "organization_1" }
}, function (v) {
v("#reportContainer").report({
resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report", defaultJiveUi: { enabled: false },
error: handleError });
function handleError(err){
alert(err.message);
} });
</script>
</body>
</html>
============================
jsfiddle: http://jsfiddle.net/zwr2ohtz/
On browser when hitting http://127.0.0.1:8080/jasperserver-pro/client/visualize.js, i am able to see the visualize.js getting downloaded.
I simply used the above code but getting the below error.
Uncaught TypeError: Cannot read property '2' of nullvisualize.js?_opt=false:9780 getLocationvisualize.js?_opt=false:10095 prepareTransportStackvisualize.js?_opt=false:10823 easyXDM.Rpcvisualize.js?_opt=false:12362 makeRpcvisualize.js?_opt=false:12515 (anonymous function)visualize.js?_opt=false:16059 (anonymous function)visualize.js?_opt=false:15902 jQuery.Callbacks.firevisualize.js?_opt=false:15948 jQuery.Callbacks.self.addvisualize.js?_opt=false:16058 (anonymous function)visualize.js?_opt=false:13187 jQuery.extend.eachvisualize.js?_opt=false:16055 (anonymous function)visualize.js?_opt=false:16115 jQuery.extend.Deferredvisualize.js?_opt=false:16054 jQuery.extend.Deferred.promise.thenvisualize.js?_opt=false:12514 Rootvisualize.js?_opt=false:12750 (anonymous function)visualize.js?_opt=false:1699 context.execCbvisualize.js?_opt=false:915 Module.checkvisualize.js?_opt=false:1192 Module.enablevisualize.js?_opt=false:823 Module.initvisualize.js?_opt=false:1465 (anonymous function)
Looks like that parameter _opt=false is workaround for me. My version is Pro 6.0.1 (30day trial).
This SyntaxError is exactly same what I've seen as well.