title: How to load an HTML fragment with JQuery ajax()?
body: <p>Please can someone tell me how to extract the content from a div on another page using the JQuery <strong>ajax() method</strong>?</p>
  
  <p><em><strong>anotherpage.html</em></strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt; 
  &lt;div id="content"&gt;I want to extract this element&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I've tried: </p>
  
  <pre><code>$.ajax({
  url: "anotherpage.html #content",
  dataType: "html"
  }).done(function(data){
  $("#results").html(data);
  })
  </code></pre>
  
  <p>But it returns the complete page and not just the #content fragment.</p>
  
  <p><em><strong>NOTE: I know how to get it working with the load() shorthand but I'd like to know how to do it with the ajax() method.</em></strong></p>
  
  <p>Thanks in advance.</p>