Getting 'data' is undefined error in I.E.11
I'm trying to load arrays from a .json doc and populate a table with this data. It works fine in Chrome and FireFox, but not in I.E. 11. When I debug in I.E. 11 I get the error 'data' is undefined for data.insuranceReport. Here's my code:
- $.getJSON('json/insuranceData.json', function(data) {
- $.each(data.insuranceReport, function(i, f) {
- var divData = "<tr>" + "<td>" + "<a href='employees/index.html" + "?dataTablePath=" + f.dataFile + "&insuranceName=" + f.insuranceName + "'>" + f.insuranceName + "</a>" + "</td>" + "<td>" + f.employeeCost + "</td>" + "<td>" + f.employerCost + "</td>" + "<td>" + f.totalCost + "</td>" + "</tr>"
- $(divData).appendTo("#dataTable tbody");
- });
- });
-
- <table id="dataTable" class="display">
- <thead>
- <tr>
- <th class="text-left"><b>Insurance Name</b></th>
- <th class="text-left"><b>Employee Cost</b></th>
- <th class="text-left"><b>Employer Cost</b></th>
- <th class="text-left"><b>Total Cost</b></th>
- </tr>
- </thead>
-
- <tfoot>
- <tr>
- <th class="text-left"><b>Insurance Name</b></th>
- <th class="text-left"><b>Employee Cost</b></th>
- <th class="text-left"><b>Employer Cost</b></th>
- <th class="text-left"><b>Total Cost</b></th>
- </tr>
- </tfoot>
-
- <tbody>
-
- </tbody>
- </table>
Any idea why this is happening?