How to pass in a struct to javascript |
(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/CodeIgnit...o-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. |
Welcome Guest, Not a member yet? Register Sign In |