JavaScript Error in 365 BC WebClient

Hi!

i'm new in connecting JavaScript and AL, so I hope you can help me:

i wrote a little JavaScript/ HTML CardPage Connection to viaualize some data.

So this is my Code, it's working perfect in my SandBox, but in Production Enviroment i get the Error: Cannot set property 'innerHTML' of null.

So my major question to you is: what is the difference between live enviroment ControlAddin Settings and Sandbox Settings.

HTML:
<!DOCTYPE html>
<html>
    <head>
        <script src="bar.js"></script> 
   </head>
<body>
  <div id="chart" bar chart here</div>

</body>
</html>


startup.js:


(function ($) {
    $(document).ready(function () {
        var url = Microsoft.Dynamics.NAV.GetImageResource("test.html");
        $("#controlAddIn").load(url);
        Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('Ready', '');
    });
})(jQuery);


 var ControlBusinessGroupsMonthly;
 ControlBusinessGroupsMonthly=$("ControlBusinessGroupsMonthly");
 


main.js
function GoBusiness (bus, j, s){

var data = [
  {label: bus[0], 
  value: s [0]
}]

for (var i = 1; i < j; i++){

  var dataCon = [
    {label: bus[i], 
    value: s [i]
  }];
   data= data.concat(dataCon);
}

// Chart Specifications
var targetId = 'chart';
 var canvasWidth = 660;
 var canvasHeight = 500;

var chart = new BarChart(targetId, canvasWidth, canvasHeight, data);
 
}


so, pretty simple, but not working.... Any Idea?
Thanx so much :)
Sign In or Register to comment.