I have some javascript that hasn't changed in over a year and suddenly it's breaking. So my first thought is it must be data related. In looking at the data, it looks like the structure hasn't change in over a year. Been running fine for a long time and suddenly it's breaking.
Here is my js, populating an array with some JSON:
var history = [{BillingCycleHistoryID: 339, BillingCycleDate: '7/18/2014', StartTime: '7/18/2014', PercentComplete: 100, EndTime: '7/18/2014', HoursRan: 0.16, StartedBy: 'ADMIN'}];
Chrome developer toolbar reports this error: "Uncaught type error: Cannot read property BillingCycleHistoryID of undefined." That error gets triggered on the line with "value.BillingCycleHistoryID" below...
if (typeof history != 'undefined') {
$.each(history, function (key, value) {
tbl.append(
'<tr data-history-id="' + value.BillingCycleHistoryID + '">' +
....[more down here]
When I paste the json into jsonlint, it throws an error that makes no sense to me:
Parse error on line 2:
[ { BillingCycleHistoryI
--------------^
Expecting 'STRING', '}'
Any idea what is going on here?