Actually, the callbackKey option is so you can specify what the GET variable
the callback should be sent as.

callbackKey: 'foo' would set a request of
myurl.com/?foo=Request.JSONP.request_map.request_0, or something similar. So
in your PHP, you need to check the same $_GET variable.

<?php

echo $_GET['foo'] . '(' . $the_json . ')';

?>

Leaving callbackKey to it's default, callback, is usually the desired
result. Then you could look for $_GET['foo'].


On Fri, Jan 21, 2011 at 12:53 AM, hartum <[email protected]> wrote:

> Thank you, thank you,  thank you,  thank you,  thank you,  thank you,
> thank you,  thank you
> very much.
>
> Finally I understand It.
>
> On 21 ene, 09:49, Andrea Dessì <[email protected]> wrote:
> > Hi hartum,
> >
> > foo is not defined because is not "global"
> >
> > in the jsfiddle I've changed the "wrapping method"....
> > look:
> >
> > http://jsfiddle.net/5uC5M/7/
> >
> > now with no wrap is working :)
> >
> > --
> > Andrea
> >
> > On Fri, Jan 21, 2011 at 09:37, hartum <[email protected]> wrote:
> > > first of all, thank you for your answers
> >
> > > second, in this moment I feel like stupid, becouse still didn't work
> >
> > > I set my callbackKey as foo:
> > > callbackKey: 'foo'
> >
> > >http://jsfiddle.net/5uC5M/6/
> >
> > > and my response as:
> > > <?php
> > >        echo 'foo({"errors":"0","disponible":0})';
> > > ?>
> >
> > > And I get this error: "foo is not defined"
> >
> > > What I am doing wrong?
> >
> > > Thanks you again.
> >
> > > On 21 ene, 08:53, Sanford Whiteman <[email protected]>
> > > wrote:
> > > > The string
> >
> > > >          ({"errors":"0","disponible":0})
> >
> > > > isn't valid JSONP.
> >
> > > > You  have  to  wrap it in a callback function.  That's why JSONP
> works
> > > > even  though  the  browser can't read the results of the script tag
> as
> > > > plain text.
> >
> > > >          cbfunc({"errors":"0","disponible":0})
> >
> > > > -- S.
>

Reply via email to