Possible Duplicate:
Can’t get correct return value from an jQuery Ajax call
How to return the response from an AJAX call from a function?
I have this:
get_json = (url) ->
$.getJSON "#{url}.json", {}, (json, response) ->
return json
But this compiles to:
getJson = function(url) {
return $.getJSON("" + url + ".json", {}, function(json, response) {
return json;
});
};
..and returns the response object. How can I return just the json instead?