Hang in there, Charlie!

 

My head was very bloody from banging it against the wall when I first
started

down the AJAX road.  Now I'm finally getting some work done with it!  I
almost

gave up several times.

 

fwiw, I have always used the $.ajax method without any problems and
typically specify

the method as "post", occasionally venturing to use "get" when just
retrieving data,

just to see what might happen.nothing different.

 

(and actually, I recognized that censored expression, having been there! :o)

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Charlie Griefer
Sent: Friday, September 25, 2009 2:06 PM
To: jQuery (English)
Subject: [jQuery] getJSON callback not firing?

 

Hey all:

I've read the docs and googled the heck out of this, but not seeing what the
problem is.

I'm trying to get some data from the server via the getJSON() method.  I do
see a response in firebug and I've validated the response data at
JSONLint.com.  However, the callback function simply will not fire.  I've
tried to simplify things as much as possible.  The CFC returning the data is
in the same directory as the calling page.  The callback function, for now,
should only alert a simple text string (which has evolved from "hi" to "foo"
to a censored version below as the hours have passed).

$(document).ready(function() {
    $('a.players').click(function() {
        $.getJSON(
 
'data.cfc?method=getPlayerByID&returnformat=JSON&queryformat=column&playerID
=' + this.id,
            function(data) {
                alert('i %!%##%* hate you');
            });
        return false;
    });
});

Here's the response I receive:

{"ROWCOUNT":1,"COLUMNS":["PLAYERID","PLAYERNAME","PLAYERNUMBER","PLAYERPOSIT
ION","PLAYERIMG","PLAYERCOLLEGE"],"DATA":{"PlayerID":[1],"PlayerName":["Bard
en,
Ramses"],"PlayerNumber":[13],"PlayerPosition":["WR"],"PlayerImg":["http:\/\/
assets.giants.com\/uploads\/players\/2FE2D3BDF4FB443D949D1D39B69ADC03.gif"],
"PlayerCollege":["Cal Poly"]}}

...which when pasted into JSONLint returns valid.

If anyone has any ideas, or if there's any additional information that I can
provide, I'm all ears.

Thanks!
Charlie

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.

Reply via email to