I'm trying to get a function to perform an ajax query and then return the interpreted JSON as an object. However for whatever reason, once this request is performed, the data is only accessible from within the function.
function getCacheImage(direction) {
jQuery.ajax({
url: json_request_string,
success: function(data) {
return data;
}
});
}
How can I get this function to return 'data' appropriately?
Thanks.