Как я могу запросить HTML, возвращенный из AJAX?
Я пробовал
$.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());
});
$html
выглядит как [meta, title, script, style#gstyle, script, textarea#csi, div#mngb, iframe, center, script, script]
и $body.html()
null
ОБНОВЛЕНИЕ
Простая установка на http://jsfiddle.net/uvnrJ/1/
$(function() {
var html = "<!doctype html><html><head><title>title here ... </title></head><body>This is the body</body></html>",
$html = $(html);
console.log($html); // jQuery(title, <TextNode textContent="This is the body">)
console.log($html.find("body")); // jQuery()
console.log($html.find("title")); // jQuery()
console.log($html.filter("title")); // jQuery(title)
});
Показывает, что jQuery, похоже, испытывает проблемы при разборе строки HTML?