How to pass in a struct to javascript - 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: How to pass in a struct to javascript (/showthread.php?tid=73783) Pages:
1
2
|
RE: How to pass in a struct to javascript - includebeer - 06-06-2019 (06-06-2019, 06:02 AM)richb201 Wrote: From the manual: You are doing it wrong. When you pass $data to your view, it creates new variables for each array member. The $data variable is not visible from the view. Read : https://codeigniter4.github.io/CodeIgniter4/outgoing/views.html#adding-dynamic-data-to-the-view In this example, you will get the variables $title, $heading and $message. Read the reply from hc-innov again. He already gave you the solution to pass data from PHP to JavaScript. Remember that PHP is executed on the server. The browser receive the html/js document generated by the server and only then the JavaScript code can be executed in the browser. |