I'm getting the following error when trying to get a JSON data string for charts.js
Uncaught TypeError: Cannot create property 'datasets' on string '{"datasets":[{"label":"My First dataset","data":[{"x":"2017-01-01","y":35},{"x":"2017-01-15","y":28},{"x":"2017-01-31","y":42}]}]}'
The JSON string I'm creating looks exactly the same like the one in an example. Also if I just copy and paste this string and set it as my data it's just working fine.
This is working:
data: {"datasets":[{"label":"My First dataset","data":[{"x":"2017-01-01","y":35},{"x":"2017-01-15","y":28},{"x":"2017-01-31","y":42}]}]},
This is not working:
.done(function( data ) {
console.log(data);
type: 'line',
data: data });
Any ideas what I am doing wrong here?