Welcome Guest, Not a member yet? Register   Sign In
How to pass in a struct to javascript
#9

(This post was last modified: 06-06-2019, 06:18 AM by richb201.)

From the manual:

$data = array(
       'title' => 'My Title',
       'heading' => 'My Heading',
       'message' => 'My Message'
);

$this->load->view('blogview', $data);

I am doing this. But in the view (called 'javascript_funcs_extensionloaded.php', I can't see the $data or data. It is in <script> tags.

From the code in the first comment I am trying to just pass in "data", not "data.command".

I have tried everything from json_encoding to using cookies to just echoing to the html page. I can't seem to get the data across. Part of the issue is that I can't seem to get phpStorm to debug the js code in the view.  Can I use alert() in the view to display the variable?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
RE: How to pass in a struct to javascript - by richb201 - 06-06-2019, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB