[jQuery] Re: newbie struggling with JSON
That sounds like something could be going astray on the server. You can check your ajax call in Firebug by opening the console, then clicking the "Net" tab, then click "XHR" - you should see the url that is being requested, plus request and response tabs. Check the response tab and make sure what you expect is being returned from the ajax call. -- Josh - Original Message - From: "Stan McFarland" <[EMAIL PROTECTED]> To: "jQuery (English)" Sent: Tuesday, May 06, 2008 4:55 AM Subject: [jQuery] Re: newbie struggling with JSON Josh, thanks for the tip. console.log(code) outputs "undefined." Any other suggestions? Thanks again, Stan On May 5, 7:42 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: Stan, I'd suggest using Firefox with the Firebug extension, and doing a console.log(code) in your callback. This will give you better information than is provided by using the alert method. -- Josh - Original Message - From: "Stan McFarland" <[EMAIL PROTECTED]> To: "jQuery (English)" Sent: Monday, May 05, 2008 2:07 PM Subject: [jQuery] newbie struggling with JSON > Hi, newbie here. Hoping someone can help. I'm able to successfully > call $.get and then eval() a URL that returns a JSON object: > $.get("myurl", > function(code) { eval(code); alert(code[0]); }); > But if I try to call $.getJSON on the same URL: > $.getJSON ("myurl", > function(code) { alert(code[0]); }); > I always get back: "code" has no properties > Any suggestions? > Thanks, > Stan McFarland > `- Hide quoted text - - Show quoted text -
[jQuery] Re: newbie struggling with JSON
Josh, thanks for the tip. console.log(code) outputs "undefined." Any other suggestions? Thanks again, Stan On May 5, 7:42 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Stan, > > I'd suggest using Firefox with the Firebug extension, and doing a > console.log(code) in your callback. This will give you better information > than is provided by using the alert method. > > -- Josh > > > > - Original Message - > From: "Stan McFarland" <[EMAIL PROTECTED]> > To: "jQuery (English)" > Sent: Monday, May 05, 2008 2:07 PM > Subject: [jQuery] newbie struggling with JSON > > > Hi, newbie here. Hoping someone can help. I'm able to successfully > > call $.get and then eval() a URL that returns a JSON object: > > > $.get("myurl", > > function(code) { eval(code); alert(code[0]); }); > > > But if I try to call $.getJSON on the same URL: > > > $.getJSON ("myurl", > > function(code) { alert(code[0]); }); > > > I always get back: "code" has no properties > > > Any suggestions? > > > Thanks, > > > Stan McFarland > > `- Hide quoted text - > > - Show quoted text -
[jQuery] Re: newbie struggling with JSON
Josh, It worked with a relative URL, but not the absolute URL. Odd... -stan On May 5, 7:42 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Stan, > > I'd suggest using Firefox with the Firebug extension, and doing a > console.log(code) in your callback. This will give you better information > than is provided by using the alert method. > > -- Josh > > > > - Original Message - > From: "Stan McFarland" <[EMAIL PROTECTED]> > To: "jQuery (English)" > Sent: Monday, May 05, 2008 2:07 PM > Subject: [jQuery] newbie struggling with JSON > > > Hi, newbie here. Hoping someone can help. I'm able to successfully > > call $.get and then eval() a URL that returns a JSON object: > > > $.get("myurl", > > function(code) { eval(code); alert(code[0]); }); > > > But if I try to call $.getJSON on the same URL: > > > $.getJSON ("myurl", > > function(code) { alert(code[0]); }); > > > I always get back: "code" has no properties > > > Any suggestions? > > > Thanks, > > > Stan McFarland > > `- Hide quoted text - > > - Show quoted text -
[jQuery] Re: newbie struggling with JSON
Stan, I'd suggest using Firefox with the Firebug extension, and doing a console.log(code) in your callback. This will give you better information than is provided by using the alert method. -- Josh - Original Message - From: "Stan McFarland" <[EMAIL PROTECTED]> To: "jQuery (English)" Sent: Monday, May 05, 2008 2:07 PM Subject: [jQuery] newbie struggling with JSON Hi, newbie here. Hoping someone can help. I'm able to successfully call $.get and then eval() a URL that returns a JSON object: $.get("myurl", function(code) { eval(code); alert(code[0]); }); But if I try to call $.getJSON on the same URL: $.getJSON ("myurl", function(code) { alert(code[0]); }); I always get back:"code" has no properties Any suggestions? Thanks, Stan McFarland `