title: How do I get JSON data from Rest APi
body: <p>I am creating an object in javascript:</p>
  
  <pre><code>    var t = null;
              $.getJSON('http://localhost:53227/Home/GetData', function (data) {
                  alert(data);
                  t = data;
              });
              alert(t);
  </code></pre>
  
  <p>When I alert data, I get an object back.
  When I alert t, it's null.</p>
  
  <p>Can you please guide, how to set "t" to the returned data?</p>