$('<div/>') // add response to fake div
.append(response)
.find('body') // find your target
.appendTo('#output'); // append the target
16,이 알아 냈어. jQuery는 동적으로 생성 된 HTML에서 "html"및 "body"태그를 발견하면 자동으로 구토합니다. 나는 그 태그들을 대체하거나 제거해야만했으며 이제 예상대로 작동한다.
var response = "<html><head><title>test</title><style>body{font-size:.9em;}</style></head><body bgcolor=\"white\"><h1>hello</h1></body></html>";
// we have to remove/replace certain tags or jquery will vomit with unexpected results
var modifiedResponse = response.replace("<html>", "").replace("</html>", "").replace("<body", "<div id='content'").replace("</body>", "</div>");
var wrappedSet = $(modifiedResponse);
wrappedSet.filter("div[id='content']").appendTo("#output");
당신이 경우에
http://jsfiddle.net/pqyeM/13/'을 console.log ($ (응답))'는'$를 사용할 수 있도록, 당신은 [
안녕하세요
]''단지 볼 (응답) .appendTo ("# output"); ' –