I have a php array that i converted in Js using the json_encode method:
$mesi = ['Nov', 'Dic'];
var js_mesi = '<?php print(json_encode($mesi)); ?>';
this is the converted array
["Nov","Dic"]
The problem I'm having now it's to place the Js array inside a JS object like this
data: {
labels: [js_mesi],
}
because the values of js_mesi are recognized as a single value and not as two separate values. The output I would like to have is this:
data: {
labels: ["Nov", "Dic"]
}
instead I see this
data: {
labels: ["Nov,Dic"]
}