Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upgradeing to jQuery 1.4.4

 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have downloaded jQuery 1.4.4 and copied to my web app. When I change the following:



to:



None of my $.getJSON() functions work.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means your JSON is invalid.

1.4 started to use the Native implementation [when available] for parsing JSON and it has to be valid for it to work.

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am betting missing quotes: http://www.jsonlint.com/
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:I am betting missing quotes: http://www.jsonlint.com/


This is the first JSON call my app makes.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is it returning as the response body?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:
Eric Pascarello wrote:I am betting missing quotes: http://www.jsonlint.com/


This is the first JSON call my app makes.




It has nothing to do with the getJSON call, it has to do with the response that comes back. The response is invalid, post the response body into JSON lint and validate it.

I would assume your JSON looks like



which is invalid.

Eric
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:What is it returning as the response body?


Here is the code in my JSP that responds to the callback

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And amazing I am right...fix your JSON or keep ignoring me

Eric
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:And amazing I am right...fix your JSON or keep ignoring me

Eric


I am really not trying to ignore you, I thank you for the help. Evn though you have told me what is wrong and I have tried to follow the advice I am stuck. I have pasted the following in the JSONLint:



And I get this:

syntax error, unexpected TINVALID at line 1
Parsing failed

But I have no idea how to fix it.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why would you paste that into JSON lint?

You want to paste what is sent to in the response to JSON lint

So the responseText would contain



put that into JSONLint
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should look like

 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:It should look like



Once again thanks for the help. However, I have tried several ways to get the following return string in the required format but I cannot get the syntax correct.



Like this gives syntax error:

 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got this to work:



Now I just have to figure out how to fix all of the return strings I have scattered through out my app.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Building JSON by hand is an exercise in frustration. I suggest a library such as Google's Gson. Your life will be better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic