title: Query HTML returned from AJAX
body: <p>How can I query HTML thats returned from AJAX?</p>
  
  <p>I tried </p>
  
  <pre><code>$.post("gethtml.php", { url: $url.val() }, function(data) {
      var $html = $(data),
              $links = $("link, script, style", $html),
              $body = $("body", $html);
  
      $links.each(function() { $(this).addClass("tmp"); });
      console.log($html);
      console.log($body.html());
  });
  </code></pre>
  
  <p><code>$html</code> looks like <code>[meta, title, script, style#gstyle, script, textarea#csi, div#mngb, iframe, center, script, script]</code> and <code>$body.html()</code> null</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>A simple setup at <a href="http://jsfiddle.net/uvnrJ/1/" rel="nofollow">http://jsfiddle.net/uvnrJ/1/</a></p>
  
  <pre><code>$(function() {
    var html = "&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;title here ... &lt;/title&gt;&lt;/head&gt;&lt;body&gt;This is the body&lt;/body&gt;&lt;/html&gt;",
        $html = $(html);
    console.log($html); // jQuery(title, &lt;TextNode textContent="This is the body"&gt;)
    console.log($html.find("body")); // jQuery()
    console.log($html.find("title")); // jQuery()
    console.log($html.filter("title")); // jQuery(title)
  });
  </code></pre>
  
  <p>Shows that jQuery seem to have problems parsing the HTML string?</p>