I am using this code to create an array using an Ajax Post request.
$('#accountholderEmail').on('keyup',function() {
$.ajax({
type: "POST",
url: "/section/get_data?getCustomer=1",
cache: false,
success: function(data){
var email_array = data;
}
});
console.log(email_array);
});
data
from the Ajax request is returning an array but its telling me that email_array is not defined in the console.log(email_array);
How can i get this variable populated with the returned data from the ajax request