I have the following javascript function
function getAppointments() {
var response;
$.getJSON('http://localhost:8000/api/appointments')
.done(function(data) {
response = data["appointments"];
});
return response;
}
when I run var a = getAppointments();
in the browser console, the function doesn't return anythin, but if I run it line by line the response
gets the returned data just fine.
Does anyone know how to fix this so the function works properly?