title: Extend ajax .done scope to wrapping function
body: <blockquote>
    <p><strong>I know this might be considered as duplicate, but I could not find a solution for my function below:</strong></p>
  </blockquote>
  
  <pre><code>    function countNoFilters(keyword){
  
      keyword = typeof keyword !== 'undefined' ? keyword : "keyword="+$("#keyword-hidden").val();
  
      var getResults = $.ajax({
          type:"GET",
          url:"",
          data:keyword
  
      });
  
      getResults.done(function(data){
          var results = $(data).find(".class").length;
          return results;
      });
  } 
  </code></pre>
  
  <p>How can I get my function <strong>'countNoFilters("keyword")'</strong> to return the <strong>return from the .done function</strong> inside ? It would be nice if someone could write a working example for my specific function.</p>