Reputation: 3106
I convert returned page content to jquery object. How can I get html content of the body tag? $(data).find('body').html() seems incorrect in this case. Here is my full script code
$.get($(this).attr('href'), function (data) {
var $dataj = $(data);
$dataj.find('#header').remove();
$('#content_left').append($dataj.find('body').html());
});
So actually I need convert jquery object back to html string
Upvotes: 0
Views: 96
Reputation: 471
basic javascript is always the turnaround to this kind of situations :
$.get($(this).attr('href'), function (data) {
var jsElement = document.createElement('html');
jsElement.innerHTML = data;
var $dataj = $(jsElement);
$dataj.find('#header').remove();
$('#content_left').append($dataj.find('body').html());
});
Upvotes: 1