attaching ajaxError

attaching ajaxError

hi

very, very new, so apologies in advance.

i want to grab some JSON using getJSON, and i want to be able to tell the difference between an ajax error and returning no JSON (in this case, no JSON would mean no results, which is fine). so, for example, i'm doing this:

var url = "json.js";
$.getJSON(url, function(data){
   if(data.length){
      console.log("you have " + data.length + " results");
   }else{
      console.log("you have no results");
   }
});


that works fine, but i delete json.js (for example) i want to know that there has been an error while making the ajax call. i looked at the ajaxError documentation, but can't work out how to apply it.

can someone please help? many thanks