my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Upgradeing to jQuery 1.4.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Upgradeing to jQuery 1.4.4" Watch "Upgradeing to jQuery 1.4.4" New topic
Author

Upgradeing to jQuery 1.4.4

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
I am betting missing quotes: http://www.jsonlint.com/
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
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

Joined: Jan 10, 2002
Posts: 60776
    
  65

What is it returning as the response body?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Nov 16, 2004
Posts: 1393
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
And amazing I am right...fix your JSON or keep ignoring me

Eric
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
It should look like

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
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

Joined: Nov 16, 2004
Posts: 1393
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

Joined: Jan 10, 2002
Posts: 60776
    
  65

Building JSON by hand is an exercise in frustration. I suggest a library such as Google's Gson. Your life will be better.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Upgradeing to jQuery 1.4.4
 
Similar Threads
$(function()) and $("#popupDatepicker39") syntax questions
Struts 2 / Tiles / Tiny MCE
Problem validating form with jQuery validation plugin
WebSphere 6.1.0.0 and JavaScript uissue
Linking to so many jquery plugins