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.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Messages In This Thread |
How to pass in a struct to javascript - by richb201 - 06-04-2019, 04:19 PM
RE: How to pass in a struct to javascript - by InsiteFX - 06-04-2019, 05:23 PM
RE: How to pass in a struct to javascript - by hc-innov - 06-05-2019, 03:25 AM
RE: How to pass in a struct to javascript - by richb201 - 06-05-2019, 05:50 AM
RE: How to pass in a struct to javascript - by hc-innov - 06-05-2019, 06:10 AM
RE: How to pass in a struct to javascript - by richb201 - 06-05-2019, 06:52 AM
RE: How to pass in a struct to javascript - by hc-innov - 06-05-2019, 07:20 AM
RE: How to pass in a struct to javascript - by richb201 - 06-05-2019, 10:25 AM
RE: How to pass in a struct to javascript - by richb201 - 06-06-2019, 06:02 AM
RE: How to pass in a struct to javascript - by includebeer - 06-06-2019, 12:16 PM
RE: How to pass in a struct to javascript - by InsiteFX - 06-06-2019, 10:35 AM
|