hub hub - 1 month ago 9
Ajax Question

How can I get a callback from a JSON request

How do I handle the response of a JSON request?

I tried using this site http://www.json.org/JSONRequest.html, but had no success!

Answer

As the jQuery API:

  var jqxhr = $.getJSON( "example.json", function() {
   console.log( "success" );
  })
  .done(function() {
    console.log( "second success" );
  })
  .fail(function() {
    console.log( "error" );
  })
  .always(function() {
    console.log( "complete" );
  });
Comments