My title say it all, I invoke an API which in return sends the data in JSON format, which I want to assign to a variable. here is my ajax code. Remember: I'm using it in an Angular application
I've tried to assign it to a variable, but it didn't worked.
$.ajax({
url: 'https://randomuser.me/api/',
dataType: 'json',
success: function(data) {
console.log(data);
}
});