Bug Tracker


Ticket #5985 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

getJSON() callback not working

Reported by: daveartz Owned by:
Priority: major Milestone: 1.4.2
Component: ajax Version: 1.4.1
Keywords: getJSON Cc:
Blocking: Blocked by:


Hey guys.

<script type="text/javascript"> $('#jsonDIV').text('Loading JSON...'); $.getJSON('json.js', function(json){

$('#jsonDIV').text('JSON complete.');

}); </script>

When I run the above code in 1.4.1, the "jsonDIV" text does not change; i.e. the callback does not execute. In Firebug, you can see that json.js is downloaded.


Dave Artz from AOL

Change History

comment:1 Changed 4 years ago by daveartz

I meant to mention this code worked in 1.3.2.

comment:2 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid

You're passing around malformed JSON. "{ ok: true }" is malformed, it would need to be:

{ "ok": true }

More information here:  http://yehudakatz.com/2010/01/15/jquery-1-4-and-malformed-json/

comment:3 Changed 4 years ago by daveartz

Thanks, that fixed it.

We generally used this method to pass around JavaScript object literals without conforming to JSON standards.

I guess we shall obey the almighty Crockford.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.