I have multiple scripts with the same object which uses the jQuery.GET to fetch some data.
crawler1.js ->
var crawlers = crawlers || {};
crawlers.Crawler1 = {
  getData : function(cb) {
    $.get('linkToSite').done(function(data){
        cb(data);
      }).fail(function(err){
          cb(false);
      });
  }
};
In app.js I have my "MainController" which needs to just receive this data.
So far I have this:
var tempData;
crawlers['Crawler1 '].getData (function(data) {
    tempData = data;
});
console.log(tempData);//This is UNDEFINED
Now I know this returns "undefined" because I'm using Asynchronous call and you don't know when it will return the data.
Is there a way to get this data out of the callback ?
I need it out of it and not something like this:
crawlers['Crawler1 '].getData (function(data) {
    tempFunc(data);
});
tempFunc(data){
    console.log(data);
}
