title: Populating a JSTree with JSON data obtained in AJAX
body: <p>I'm trying to populate a JSTree with JSON data that I'm obtaining from a service (which is called using ajax). However, I am getting a "Neither data nor ajax settings supplied error" in the jquery.jstree.js file. Because of this the JSTree just displays a loading gif.</p>
  
  <p><strong>AJAX code</strong> (editted to try setting json to local variable test, then return test)</p>
  
  <pre><code>function getJSONData() {
      var test;
      $
              .ajax({
                  async : true,
                  type : "GET",
                  url : "/JavaTestService/rs/TestService/MyFirstTestService?languageCode=en_US&amp;version=2",
                  dataType : "json",
  
                  success : function(json) {
                      test = json;
                  },
  
                  error : function(xhr, ajaxOptions, thrownError) {
                      alert(xhr.status);
                      alert(thrownError);
                      test = "error";
                  }
              });
      return test;
  }
  </code></pre>
  
  <p><strong>JSTree code</strong></p>
  
  <pre><code>var jsonData = getJSONData();
  createJSTrees(jsonData);
  
  function createJSTrees(jsonData) {
          $("#supplierResults").jstree({
              "json_data" : {
                  "data" : jsonData
              },
              "plugins" : [ "themes", "json_data", "ui" ]
          });
  </code></pre>
  
  <p>After some debugging, I've found that jsonData is undefined when passed to the createJSTrees method. Am I retrieving that data correctly in the Ajax code?
  Thanks in advance</p>