I have found many blogs talking about how you can have your controller
send to your view the results of some:
$data = $this->MyModel->find('all', array('some params'));
$this->set('data', $data);
And then in your view:
echo $javascript->object($data);
Now, how the heck in the view using Javascript do I access the results
of that method. I know it outputs a JSON string, and I figured I would
probably want to output it in a javascript var in my layout like:
<script type="text/javascript">
var myJsonObject = <?php echo $javascript->object($data); ?>;
</script>
So how (using Javascript) in my view do I access the data in
myJsonObject???
Like I want to populate some select dropdowns with it. Just not sure
of the syntax to access myJsonObject.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---