If $.getJSON() succeeds in getting the JSON data, then a function is called, as shown below. How do I catch the returned value output?
$.getJSON(url, function(data) {
// Do stuff with data if succeeds in getting the data
return output;
}
);
Since you want to invoke another function when the callback finishes, you should do that in the callback itself. It is invoked asynchronously and the result is not there on the next line. So: