title: get returned values from jquery get?
body: <p>I am making jquery calls to get and getJSON, but cannot access returned values outside of callback function. How can I access the returned data?</p>
  
  <pre><code>        var firstid;
          var nextid;
  
      $.get(callUrl, function(data) {  // call to add node
           var n = data.indexOf("id-");
           var m = data.indexOf("id-");
           firstid = data.substr(n+3,m - (n+3));
           nextid = data.substr(m+3);
  
               alert("firstid:" + firstid);  // returns correct value
      });
  
          alert("firstid:" + firstid);  // returns undefined for firstid
  </code></pre>
  
  <p>how can I get firstid outside the function?</p>