- 5.8k
- 11
- 72
- 144
I have a json array in php and I want to pass it to javascript so I can use it with google charts.
If I do this: var a = ;
var a = <?php echo((json_encode($data))); ?>;
I get the data in the format Name,Value,PHP,78,JAVA,1000,HTML,129Name,Value,PHP,78,JAVA,1000,HTML,129 but I want to keep it in the jsonjson format that it was in [["Name","Value"],["PHP",78],["JAVA",1000],["HTML",129]]
[["Name","Value"],["PHP",78],["JAVA",1000],["HTML",129]]
because google charts needs to receive it like this. Any idea how to do this?
I have a json array in php and I want to pass it to javascript so I can use it with google charts.
If I do this: var a = ; I get the data in the format Name,Value,PHP,78,JAVA,1000,HTML,129 but I want to keep it in the json format that it was in [["Name","Value"],["PHP",78],["JAVA",1000],["HTML",129]] because google charts needs to receive it like this. Any idea how to do this?
I have a json array in php and I want to pass it to javascript so I can use it with google charts.
If I do this:
var a = <?php echo((json_encode($data))); ?>;
I get the data in the format Name,Value,PHP,78,JAVA,1000,HTML,129 but I want to keep it in the json format that it was in
[["Name","Value"],["PHP",78],["JAVA",1000],["HTML",129]]
because google charts needs to receive it like this. Any idea how to do this?
Pass json object from php to javascript
I have a json array in php and I want to pass it to javascript so I can use it with google charts.
If I do this: var a = ; I get the data in the format Name,Value,PHP,78,JAVA,1000,HTML,129 but I want to keep it in the json format that it was in [["Name","Value"],["PHP",78],["JAVA",1000],["HTML",129]] because google charts needs to receive it like this. Any idea how to do this?