Hi,

> The json object is returned from the server and is a JSONArray...

You mean JSONArray as in the Java wrapper for JSON arrays from
json.org? An array can't be the top-level object in a JSON dataset.
Not that that's likely to be your problem, I'm just saying...

Do you ever see more than one "header==true" alerts? Are they really
alerts? (See my earlier note.)

-- T.J.

On Apr 14, 3:55 pm, chrysanthe m <[email protected]> wrote:
> Hi TJ
> Sorry for insufficient detail
> The json object is returned from the server and is a JSONArray, composed of
> hetrogenous elements, but all of which have a server-side defined boolean
> header element.  What I was hoping to do is put both types of elements into
> this one JSONArray and selectively process.  I have it working just fine
> with all header elements, but I just cant get it to execute the
> header==false code.  What I found so odd was the the non-testing line didnt
> even print.  I would have expected that line to print along with either
> depending on the value of header.  I know how preposterous it is to claim
> control flow is broken, but it is appearing like it is just breaking out of
> the loop and not executing anything.  I will try changing the serial
> position, but it should print that "testing continuing flow" line no matter
> what.  I am nonplused.
>
> On Wed, Apr 14, 2010 at 10:41 AM, T.J. Crowder 
> <[email protected]>wrote:
>
>
>
> > Hi,
>
> > It would be useful if you said what the `json` variable references.
> > You're treating whatever it is like an array, so I'll assume that here
> > -- or at least, that it has a `length` property and properties with
> > the names `0`, `1`, etc.
>
> > So you're saying
>
> > 1. It does show "testing header==true" at least once.
> > 2. It does not show "testing continuing flow".
> > 3. It does not show "testing header==false".
>
> > I can't immediately think of any form that `json` would take that
> > would exhibit the behavior you're describing, particularly not #1
> > combined with #2. Have you edited that code snippet by any chance? For
> > instance, replaced some other output mechanism with `alert`? If so,
> > I'd have a good hard look at the output mechanism you replaced.
>
> > FWIW.
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / com
> >www.crowdersoftware.com
>
> > On Apr 14, 2:51 pm, chrysanthe m <[email protected]> wrote:
> > > Hello
> > > I am perplexed with what I believe is an error the code snippet below
> > only
> > > prints out
> > > "testing header==true" for iterations that have a header==true in the
> > > returned json object.
> > > Now the oddity.
> > > 1.  It does not printout "testing continuing flow" anytime
> > > 2.  It does not printout "testing header==false" for iterations that have
> > a
> > > header==true in the returned json object
>
> > >          for(i=0;i<json.length;i++){
> > >           if(json[i].header==true){
> > >           alert("testing header==true.");
> > >           }  //10413  end of only header==true
> > >           alert("testing continuing flow.");
> > >           if(json[i].header==false){
> > >             alert("testing header==false.");
> > >           }
> > >         }
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Prototype & script.aculo.us" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<prototype-scriptaculou 
> > s%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.

Reply via email to