title: Parse a JSON object to get ResponseJSON from Jquery Ajax callback
body: <p>I am hitting an API and would like to isolate the data contained in <code>responseJSON</code> returned from it. <code>console.log(mydata)</code> yields undefined, despite it clearly being there when I do <code>console.log(a)</code> (see screenshot).</p>
  
  <p>My code:</p>
  
  <pre><code>function onComplete(a){ 
      console.log(a);
      return a['responseJSON']
  }
  function getData(whenDone){
       var data = $.get('http://127.0.0.1:5000/');
           whenDone(data);
  
  }
  var mydata= getData(onComplete)
  console.log(mydata);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/KHrTk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KHrTk.png" alt="enter image description here"></a></p>