getJSON callback with success?

getJSON callback with success?

Hi! I have build a weather app with jQuery, and everthing works nice. The url is https://api.forecast.io/forecast/ with a couple of parameters after that. I have created a bunch of variables to store the data. Finally in the end I do like this:


  1.   var forecastData = function () {
        $.getJSON(url, callback);
       };
     
      $(document).ready(function() {
       forecastData();

      });


My question now if there's some easy way to handle errors, like if not null (if a param like longitude is missing), success/error - but to keep what I have coded so far? Have tried a bunch of thing but it wont work.


Thanks!