title: How to return json object in javascript function?
body: <p>I've this function</p>
  
  <pre><code>function getTags(level){
      $.getJSON("php/get-tags.php", { "parent": level }, function(json) {
          return json;
      });
  }
  </code></pre>
  
  <p>I'm calling this function as</p>
  
  <pre><code>$(function(){
      var tags = getTags('0');  
  });
  </code></pre>
  
  <p>The problems is, in the function <code>getTags()</code> the return <code>json</code> is like </p>
  
  <p><code>{"tags":["Mathematics","Science","Arts","Engineering","Law","Design"]}</code></p>
  
  <p>but at <code>var tags = getTags('0')</code>, catching the return value, it gets an <code>undefined</code> value.</p>
  
  <p>Is the way I'm returning the value incorrect?</p>