json would be a good ideia if need pagination for example and you dont need a view exiting before..
Regards, -- Att, Everton Yoshitani www.notreve.com +81-80-3660-6560 2008/12/18 brian <[email protected]>: > > On Wed, Dec 17, 2008 at 6:29 PM, Hipnotik <[email protected]> wrote: >> >> Hi >> I would like to build 2 javascript arrays in the view from data loaded >> in controller. >> >> Solution 1: >> use getJSON in $(document.ready) >> ... not good for me >> >> Solution 2: >> set 2 php arrays in controller's method as available in the view: >> $this->set("arr1", $arr1); >> $this->set("arr2", $arr2); >> and the build js arrays in myview.ctp file >> ... not good too... >> >> Is it possible to pass data from controller to js file placed in >> webroot/js/ folder? Without ajax offcourse. >> >> Any other ideas? >> > > Writing a JS file from the controller would be a terrible idea, > actually. You can create a block of inline javascript. See here: > > http://api.cakephp.org/class_javascript_helper.html#7a48cb0c29a9c0b62e1057bedb5f6407 > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
