I even sent a test string without the [ ]  and I still get 'undefined'
for my alert here:

function mycarousel_itemLoadCallback(carousel, state) {

    // Only load items if they don't already exist
    if (carousel.has(carousel.first, carousel.last)) {
        return;
    }

    $.getJSON("http://localhost:59396/sss/CHandler.ashx?
action=productsjson",
        function(data) {
            alert(data.items);
            $.each(data.items, function(i, item) {
                carousel.add(i, mycarousel_decodeEntities(item));
                if (i == 3) return false;
            });
        });
};

the JSON in this case was:

{"ImageTag":"<img src="http://www.xxx.com/image/473.jpg"
alt="">"},{"ImageTag":"<img src="http://
www.xxx.com/cat_image/485.jpg" alt="">"}

so same deal here.  I'm stuck.

On Jun 29, 11:03 am, MorningZ <[email protected]> wrote:
> http://en.wikipedia.org/wiki/JSON
>
> will show you what it should look like... notice the outside symbols
> are { ... }, not [ .... ]
>
> again, you should look at this if you are working with .NET and JSON,
> it really takes all this guess work from the equation:
>
> http://james.newtonking.com/pages/json-net.aspx
>
> On Jun 29, 12:01 pm, expresso <[email protected]> wrote:
>
> > Ok, so what should it be wrapped in or how should I reformat this?
>
> > On Jun 29, 10:58 am, MorningZ <[email protected]> wrote:
>
> > > Wow, is posting the same thing every 3 mins to bump your topic
> > > annoying....
>
> > > Anyways,
>
> > > your results wrapped in [ .... ] signifies an Array, not a JSON
> > > object....  hence ".getJSON" has no idea what to do with it
>
> > > On Jun 29, 11:53 am, expresso <[email protected]> wrote:
>
> > > > So is this valid JSON that jQuery can parse? or do I need an initial
> > > > level such as "Images":
>
> > > > [{"Images" :
> > > > [{"ImageTag":"&lt;img src=&quot;http://www.xxx.com/image/473.jpg";
> > > > alt=&quot;&quot;&gt;"},{"ImageTag":"&lt;img 
> > > > src=&quot;http://www.xxx.com/image/4852.jpg"; alt=&quot;&quot;&gt;"}
> > > > ]]
>
> > > > On Jun 29, 10:37 am, expresso <[email protected]> wrote:
>
> > > > > Ok, figured out that data.items is undefined. Not sure why because
> > > > > here's the json my url returns:
>
> > > > > [{"ImageTag":"&lt;img src=&quot;http://www.xxx.com/image/473.jpg";
> > > > > alt=&quot;&quot;&gt;"},{"ImageTag":"&lt;img 
> > > > > src=&quot;http://www.xxx.com/image/4852.jpg"alt=&quot;&quot;&gt;"}]
>
> > > > > On Jun 29, 10:33 am, expresso <[email protected]> wrote:
>
> > > > > > I get the following error:
>
> > > > > > G is undefined
> > > > > > init()()jquery-1....2.min.js (line 12)
> > > > > > (?)()()Carousel.aspx (line 30)
> > > > > > I()jquery-1....2.min.js (line 19)
> > > > > > F()()jquery-1....2.min.js (line 19)
> > > > > > [Break on this error] (function(){var 
> > > > > > l=this,g,y=l.jQuery,p=l.....each
> > > > > > (function(){o.dequeue(this,E)})}});
>
> > > > > > in jquery-1.3.2.min.js
>
> > > > > > when I call this method of mine:
>
> > > > > >     $.getJSON("http://localhost:59396/xxx/xxxHandler.ashx?
> > > > > > action=xxxjson",
> > > > > >         function(Data) {
> > > > > >         $.each(Data.items, function(i, item) {
> > > > > >         alert('got here');
> > > > > >         carousel.add(i, mycarousel_decodeEntities(item.ImageTag));
> > > > > >                 if (i == 3) return false;
> > > > > >             });
> > > > > >         });
>
> > > > > > I know I can get inside function(Data){ and that the error starts at
> > > > > > $.each I believe

Reply via email to