It preloads a list of contracted employees per year/term for
population into a select box upon selecting a year and term.

As has been noted by others, it is missing the array keys and simply
generating an array instead of a JSON associative array at the top
level. At this point, I'm using custom code... but I'd prefer one line
of code to twenty to generate the JSON data. :)

On Apr 11, 11:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Yes thats a JSON representation of a multidimensional array (wrapped
> in braces and blocks).
> What were you planning on using this for?
>
> On Apr 11, 10:07 am, "Joshua Benner" <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to pass PHP data to Javascript (pre-loading data).
>
> > It's my understanding that JavascriptHelper::object should generate
> > JSON representation of the PHP data passed to it, but I'm
> > misunderstanding how to apply the method. Below is the test I ran and
> > the unexpected result I get. Is this proper behavior of the function?
>
> > This is a sample PHP array with similar structure to what I'm trying
> > to JSON-ify:
>
> > array(
> >         '2007'=>array(
> >                 'Spring'=>array(
> >                         '1'=>array('id'=>'1','name'=>'Josh'),
> >                         '2'=>array('id'=>'2','name'=>'Becky')
> >                 ),
> >                 'Fall'=>array(
> >                         '1'=>array('id'=>'1','name'=>'Josh'),
> >                         '2'=>array('id'=>'2','name'=>'Becky')
> >                 )
> >         ),
> >         '2006'=>array(
> >                 'Spring'=>array(
> >                         '1'=>array('id'=>'1','name'=>'Josh'),
> >                         '2'=>array('id'=>'2','name'=>'Becky')
> >                 ),
> >                 'Fall'=>array(
> >                         '1'=>array('id'=>'1','name'=>'Josh'),
> >                         '2'=>array('id'=>'2','name'=>'Becky')
> >                 )
> >         )
> > )
>
> > And this is the Javascript that it yields:
>
> > [{"Spring":[{"id":1, "name":"Josh"}, {"id":2, "name":"Becky"}], "Fall":
> > [{"id":1, "name":"Josh"}, {"id":2, "name":"Becky"}]}, {"Spring":[{"id":
> > 1, "name":"Josh"}, {"id":2, "name":"Becky"}], "Fall":[{"id":1,
> > "name":"Josh"}, {"id":2, "name":"Becky"}]}]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to