I create query in laravel 5.6
I need print json array in Jquery.
Return query in laravel is:
[
{
"day": 19,
"count": 1
},
{
"day": 18,
"count": 3
}
]
Script code is:
var chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": [
{
"day": 19,
"count": 1
},
{
"day": 18,
"count": 3
}
].reverse(),
.
.
.
.
I place {{ json_encode($query) }} in Jquery code:
var chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": [ {{ json_encode($query) }} ].reverse(),
.
.
.
.
But this code is not work...
How to issue this problem?
dayandcountproperty names. Also note that you don't need the extra[]around{{ json_encode($query) }}[]becouse use].reverse().