James... thanks for posting that, great article explaining what's
going on during that kind of call

On Mar 3, 1:36 pm, James <james.gp....@gmail.com> wrote:
> Here's an article from IBM I've 
> Googled:http://www.ibm.com/developerworks/library/wa-aj-jsonp1/
> I think it's fairly easy to understand and detailed. I think the
> difficult part of JSONP is that the jQuery docs does not show an
> example of how the server-side output is suppose to look like.
>
> On Mar 2, 10:13 pm, Charles Liu <charles.li...@gmail.com> wrote:
>
> > usually you should use $.getJSON when you need jsonp to get data from
> > another domain
>
> > On 3月3日, 上午8时17分, craigpierce <craigpie...@gmail.com> wrote:
>
> > > Hi All -
>
> > > I'm fairly new to jQuery, and totally new to jsonp.  I would like to
> > > see an example of an $.ajax call using jsonp - as of right now, this
> > > is what I have tried (based on examples found via Google searches and
> > > the text description on the $.ajax page), but nothing fires any of the
> > > callbacks:
>
> > > One:
> > > function test(){
> > >         var jsonObj ={
> > >                 dataOne: "foo",
> > >                 dataTwo: "foo",
> > >         };
>
> > >         $.ajax({
> > >                 type:          "GET",
> > >                 url:             "https:myurl.com",
> > >                 dataType:   "jsonp",
> > >                 data:          jsonObj,
> > >                 error:          function(){alert('bad');},
> > >                 success:    function(){alert('good');},
> > >                 complete:   function(){alert('foo');}
> > >         });
>
> > > }
>
> > > Two:
> > > function test(){
> > >         var jsonObj ={
> > >                 dataOne: "foo",
> > >                 dataTwo: "foo",
> > >         };
>
> > >         $.ajax({
> > >                 type:          "GET",
> > >                 url:             "https:myurl.com",
> > >                 dataType:   "jsonp",
> > >                 jsonp:        "testCallback",
> > >                 data:          jsonObj
> > >         });
>
> > > }
>
> > > function testCallback(){alert('foo');}
>
> > > Three:
> > > function test(){
> > >         var jsonObj ={
> > >                 dataOne: "foo",
> > >                 dataTwo: "foo",
> > >         };
>
> > >         $.ajax({
> > >                 type:          "GET",
> > >                 url:             "https:myurl.com?testCallback=?",
> > >                 dataType:   "jsonp",
> > >                 data:          jsonObj
> > >         });
>
> > > }
>
> > > function testCallback(){alert('foo');}
>
> > > Four:
> > > function test(){
> > >         var jsonObj ={
> > >                 dataOne: "foo",
> > >                 dataTwo: "foo",
> > >         };
>
> > >         $.ajax({
> > >                 type:          "GET",
> > >                 url:             "https:myurl.com?callback=testCallback",
> > >                 dataType:   "jsonp",
> > >                 data:          jsonObj
> > >         });
>
> > > }
>
> > > function testCallback(){alert('foo');}
>
> > > Any help would be much appreciated!  Thanks!!!

Reply via email to