I want to get the response value from the get()
method to use somewhere else in my code. Here is the code:
$.get('all-document-types', function( response ) {
var data = [];
$.each(response,function(index,value){
data.push(value.document_type);
});
return data;
});
However, I am getting a undefined variable if I tried to access it outside of the callback function. So how can I get value?