title: How can I get this function to return value retrieved using jQuery.ajax?
body: <p>I need to return dynamic loaded content. I thought this was the way to do it, but the function returns blank. What do I need to do in order to set <code>htmlCode</code> with the html code retrieved from <code>jQuery.ajax</code>?</p>
  
  <pre><code>  // Get directory listing
    function getHTML(instance, current_path, dir) {
      var htmlCode = '';
  
        jQuery.ajax({
            type: "POST",
            url: "../wp-content/plugins/wp-filebrowser/jquery.php",
            dataType: 'html',
            data: {instance: instance, current_path: current_path, dir: dir},
            success: function(html){
                htmlCode = html;
            },
            error: function(e) {
              htmlCode = '[Error] ' + e;
            }
        });
  
        return htmlCode;
    }
  </code></pre>