Getting string data from ajax request : result is dates and number of events on specific dates.
[['2012-06-20',13],['2012-06-21',2],['2012-06-22',2],['2012-06-24',1],['2012-07-04',1],['2012-07-05',4],['2012-07-13',1],['2012-08-14',1],['2012-08-15',1],['2012-08-17',1],['2012-08-20',1],['2012-08-26',1],['2012-08-30',4],['2012-09-01',8],['2012-09-04',13],['2012-09-08',1],['2012-09-09',2],['2012-10-06',1],['2012-10-08',7],['2012-10-09',18],['2012-10-14',12],['2012-10-15',3],['2012-10-17',2],['2012-10-18',5],['2012-10-20',4],['2012-10-24',1],['2012-10-31',9],['2012-11-02',3],['2012-12-05',1],['2012-12-20',3],['2012-12-23',1],['2012-12-25',3],['2012-12-29',1],['2013-01-02',3],['2013-01-03',2],['2013-01-04',3],['2013-01-10',6],['2013-01-11',2],['2013-01-18',1],['2013-02-20',5],['2013-02-26',2],['2013-03-08',1],['2013-03-12',2],['2013-03-23',1],['2013-04-01',1],['2013-04-03',4],['2013-04-04',1],['2013-05-02',1],['2013-05-25',6],['2013-05-28',1],['2013-05-29',1],['2013-05-30',1],['2013-06-04',1],['2013-06-10',1],['2013-06-17',1],['2013-08-31',3],['2013-09-08',1],['2013-09-30',2],['2017-05-07',2],['2017-05-19',1],['2017-05-21',1],['2017-05-22',1],['2017-05-29',1],['2017-05-31',3],['2017-06-08',1],['2017-06-13',1],['2017-06-15',1],['2017-06-23',1],['2017-06-28',1],['2017-07-30',1],['2017-08-17',3],['2017-08-22',1],['2017-08-23',1],['2017-08-24',2],['2017-08-31',1],['2017-09-04',1],['2017-09-05',1],['2017-09-08',1],['2017-09-17',8],['2017-09-26',1],['2017-10-02',2],['2017-10-03',1],['2017-10-04',3],['2017-10-31',2],['2017-11-07',1],['2017-11-08',1],['2017-11-14',2],['2017-11-20',2],['2017-12-06',1],['2017-12-15',1],['2018-01-02',1],['2018-01-09',2],['2018-01-11',3],['2018-01-15',2],['2018-01-17',2],['2018-03-14',2],['2018-03-27',2],['2018-04-11',2],['2018-04-19',1],['2018-04-23',2],['2018-05-29',1],['2018-06-04',1],['2018-08-07',1],['2018-10-31',2],['2018-11-01',2],['2018-12-05',1],['2018-12-06',1],['2018-12-09',3],['2019-03-03',1],['2019-03-07',4],['2019-03-09',3],['2019-03-10',8],['2019-03-18',1],['2019-04-15',13],['2019-10-14',1],['2019-12-11',1],['2020-01-08',3],['2020-01-14',1],['2020-01-20',6],['2020-01-28',1],['2020-02-16',2],['2020-02-25',1],['2020-04-15',1],['2020-05-11',1],['2020-05-18',1],['2020-05-23',2],['2020-05-27',4],['2020-05-28',1],['2020-09-03',17],['2020-09-22',1],['2020-09-29',1],['2020-10-01',2],['2020-10-02',2],['2020-10-07',3],['2020-12-01',1],['2021-02-10',1],['2021-02-22',2],['2021-11-29',3],['2021-11-30',2],['2022-04-09',1],['2022-04-26',3],['2024-03-31',1],['2024-04-20',3]]
Yes, this code brings an error “Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 3 of the JSON data”
Code:
$.ajax({
async: false,
url: url,
dataType: "text",
success: function(data) {
P1Tickets = JSON.parse(data);
var plot1 = $.jqplot('ticket_weekly_p1_stati', [P1Tickets], {
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer
}
},
series:[{lineWidth:4, markerOptions:{style:'square'}}]
});
}
});
Anyone able to bring me clarity?
Br
Lars
4