I am working on a Javascript / JQuery project that requires that I get data from another website. I use the following JQuery code to achieve this:
var user = "Bob";
url = "https://api.example.com/api/" + user;
$.get(url, function(data){
profiles = data;
});
alert(profiles);
For some reason when I run the code I get this Error Message:
Uncaught ReferenceError: profiles is not defined
But when type "profiles" in the google chrome javascript console, I see my target data. What am I doing wrong?
Thanks- Evan