Passing Json Data From Controller To View For Morris.js Bar Chart - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Passing Json Data From Controller To View For Morris.js Bar Chart (/showthread.php?tid=65995) |
Passing Json Data From Controller To View For Morris.js Bar Chart - wolfgang1983 - 08-21-2016 I am using morris.js bar chart I am a bit confused on how to pass json data to it from my controller function. My xkey is the days and user data is the count. Code: {"xkey":[[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10],[11,11],[12,12],[13,13],[14,14],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22],[23,23]],"user":{"data":[[2,"1"],[3,"1"]]}} Question how can I get the json data from controller to the view for xkey and ykeys"user data". My controller function PHP Code: public function chart_data() { On my view script Code: <script type="text/javascript"> RE: Passing Json Data From Controller To View For Morris.js Bar Chart - InsiteFX - 08-21-2016 Read This |