Change Div contents.

by Pavel Savushchyk

HTML

<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<script src="http://code.jquery.com/jquery-3.1.1.js"></script>
<script type='text/javascript' src="http://10.98.49.200:8080/jasperserver-pro/client/visualize.js?_opt=true"></script>

<body>
				<a href="#" id="withdata" name="withdata">1. With Data</a><br />
				<a href="#" id="withoutdata" name="withoutdata">2. No Data</a><br />
				<a href="#" id="changediv" name="changediv">3. Change Div</a><br />
        <a href="#" id="withdata" name="withdata">1. With Data</a><br />
  <div id="container" style="height:200; padding-bottom:0px"></div>
</body>

JavaScript

var report;

$(function(){
		visualize({
		auth: {
			name: "superuser",
			password: "superuser"
		}
		}, function(v) {
			report = v.report({
			resource: "/public/Samples/Reports/9g.CustomerDetailReport",
			params: { 
			"customerId":["2724"]},
			container: "#container",
			error: function(err) {
				alert(err.message);
					}
				});
			});
			$( "#withdata" ).click(function() {
		//	debugger;
			if(report)
			{
				report.params({"customerId":[2724]}).refresh();
			}
		});
		
			$( "#withoutdata" ).click(function() {
		//	debugger;
			if(report)
			{
				report.params({"customerId":[1]}).refresh();
			}
		});  
    
			$( "#changediv" ).click(function() {
		//	debugger;
			if(report)
			{
				$("#container").html("NO DATA FOR YOU! - cause I am old and still do Seinfeld jokes....");

			}
		});
		});