I have some AJAX call like this:
$.ajax({
type: 'GET',
url: <some url>,
dataType: 'html',
success: function(html){
// do some jQuery on the response html
// like this: $('#someDIV').text();
}
});
The response html likes this:
<html>
<head>
<!-- header things -->
</head>
<div id="someDIV">
content
<div>
</html>
Can I do the query on that response html without append the code to current page?
var newHtml = $(html);and manipulate the variable without appending it to the body.$(html)will flatten the DOM and remove elements like HEAD and BODY and any SCRIPT tags.