title: How do I filter the returned data from jQuery.ajax()?
body: <p>When using the <code>jQuery.ajax()</code> method, I am struggling to filter the data that is returned to get exactly what I need. I know this is easy using <code>.load()</code> and probably the other jQuery AJAX methods but I need to use <code>.ajax()</code> specifically.</p>
  
  <p>For example I know that this works;</p>
  
  <pre><code>var title = $(data).filter('title'); // Returns the page title
  </code></pre>
  
  <p>But what if I just want the contents of a div with id="foo"?</p>
  
  <pre><code>var foo = $(data).filter('#foo'); // None of these work
  var foo = $(data).find('#foo');   //
  var foo = $('#foo', data);        //
  </code></pre>
  
  <p>Ideally, I want one method into which I can pass a normal jQuery selector, which will work for selecting titles, divs, or any other element that jQuery can select. This is so that I can pass in any string into my own ajax function - eg;</p>
  
  <pre><code>myApp.ajax({
      url: 'myPage.html',
      filterTitle: 'title',
      filterContent: '#main-content'
  });
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>