For JSONP, the server needs to wrap the response in the supplied callback. The cross-domain getJSON function is basically appending a script to the page, with the contents of that script being a function containing the data you want to pass back. Play around with the URL in the flickr example from the docs and you can see how the response is wrapped:
http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=foo On Jul 6, 7:44 am, expresso <dschin...@gmail.com> wrote: > This works fine: > > $.getJSON("http://localhost:59396/xxxWeb/ > CarouselHandler.ashx?action=getproducts&ids=" + ids, > function(data) { > > carousel.size(allProductIDs.length); > > if (numberOfImagesLeftToShow < > numberOfImagesToDisplay) { > first += (numberOfImagesToDisplay - > numberOfImagesLeftToShow); > } > > var d = 0; > for (var i = first; i <= last; i++) { > > if (d != undefined) { > // add data using index of the array > returned by JSON (which starts at 0) > carousel.add(i, decode(data[d].ImageTag)); > } > > // set to last ProductID showing in Carousel > if (i == last) { lastProductID = parseFloat > (data[d].ProductID); } > > d++; > } > } > ); > > This does not work, I get no pictures rendered after trying to add the > &format=json&jsoncallback=? : > > $.getJSON("http://localhost:59396/xxxWeb/ > CarouselHandler.ashx?action=getproducts&ids=" + ids + > "&format=json&jsoncallback=?", > function(data) { > > carousel.size(allProductIDs.length); > > if (numberOfImagesLeftToShow < > numberOfImagesToDisplay) { > first += (numberOfImagesToDisplay - > numberOfImagesLeftToShow); > } > > var d = 0; > for (var i = first; i <= last; i++) { > > if (d != undefined) { > // add data using index of the array > returned by JSON (which starts at 0) > carousel.add(i, decode(data[d].ImageTag)); > } > > // set to last ProductID showing in Carousel > if (i == last) { lastProductID = parseFloat > (data[d].ProductID); } > > d++; > } > } > ); > > Same for here, calling to our dev server. > > $.getJSON("http://xxxdev/xxx/CarouselHandler.ashx? > action=getproducts&ids=" + ids + "&format=json&jsoncallback=?", > function(data) { > > No idea why. No errors, nothing.