Hi Scott, got to play around with it a little & have some if it
figured out, thanks.
the json_encode() of my php array returns something like:

["box1","box2","box3","box4"]

the cookie returns something like:

{"box2":"closed","box4":"closed"}

so any idea where I go from here?




On May 15, 3:06 pm, thekman <[EMAIL PROTECTED]> wrote:
> Thnaks Scott,
> but no idea yet how to do that.
> any chance you could provide a short example i could play with & try
> to get working?
>
> On May 15, 2:56 pm, Scott González <[EMAIL PROTECTED]> wrote:
>
> > Generate an array of the $box_id's in the loop.  You can check the
> > cookie directly in PHP using the $_COOKIE superglobal.  After the
> > loop, create your script.  You can generate a JavaScript array from
> > your PHP array using json_encode().  Just pass that array in as the
> > selector for the jQuery object and you'll end up with just one line if
> > JavaScript.
>
> > On May 14, 5:21 pm, thekman <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
> > > I'm using cookies to hide some content on page load & at the moment
> > > the jQuery code to do this inside a php loop, so the code below gets
> > > executed up to 20 times.
> > > any ideas on how i would include this only once to hide all content
> > > supposed to be hidden?
>
> > > ...
> > > while (!$display->EOF and $cnt < 20) {
> > > other php code...
> > > ?>
>
> > > <script type="text/javascript">
> > >   $(document).ready(function(){
> > >   if ($.cookieJar('CookieJar').get('<?php echo $box_id; ?>')) {
> > >   $("#<?php echo $box_id; ?>").hide();}
> > > });
>
> > > </script>
>
> > > <?php  $display->MoveNext(); ?>

Reply via email to