When you use callback=? jQuery will create a random name for the
anonymous function you pass in. For example:

$.getJSON("CarouselHandler.ashx?jsoncallback=?",function(data) {
});

The actual requested URL will be CarouselHandler.ashx?
jsoncallback=abc12345, and the global variable 'abc12345' will be
assigned your function. So all the server-side script has to do is use
the parameter and send back properly formatted JSON:

abc12345({ carousel: [1,2,3] })

If that's all correct, is your callback at least firing? Put an alert
() or log() inside it and see if you get to it.

On Jul 6, 2:09 pm, expresso <dschin...@gmail.com> wrote:
> Ok, so their sending back a json response wrapped with method foo.  So
> then how would you specify foo in my example as the method to call on
> the getJSON script I've created?
>
> I think my example is fine as it is.  We're not going cross server for
> now but wanted to understand how to form this and how this worked a
> little more.  MK explained the response coming back, a huge part of
> this!  The jQuery docs need to explain this, it's pretty inferred to
> some who have done this before, but not that obvious to others that
> this is how it works...that you are essentially wrapping what you are
> sending back in the method that you want to call in your callback.
>
> On Jul 6, 10:56 am, Bill Ramirez <betbuil...@gmail.com> wrote:
>
> > If you pass a param to the json call, it gets passed into the
> > querystring:
>
> > $.getJSON("jsdata/customerhandler.ashx", { show: Math.random(),
> > departmentId: dptId}, customerLoaded);
>
> > would be rendered as:
>
> > jsdata/customerhandler.ashx?show=0.23231553&departmentId=123
>
> > the second parameter to the getJson function is the query string
> > parameters.

Reply via email to