I'm trying to get the success data from a jquery Ajax call so I can use it elsewhere but for some reason its only accessible within the actual success call, so immeditaly below works but the other doesnt'.. any advice is appreciated
success: function(data) {
alert (data)
}
this doesn't work when I try to pass "data" onto another function
$.ajax({
type: 'POST',
url: 'http://localhost/site1/utilities/ajax_component_call_handler',
data: {
component_function: component_function,
param_array: param_array
},
dataType: "json",
success: function(data) {
receiver (data)
}
});
}
my ajax success is calling this:
function receiver (data) {
ajax_return = data
alert (ajax_return)
}