I'm trying to load another page content via AJAX. It loads the content, but I have a problem with parsing new content.
Here is my code
$.get(urlPath, function (content) {
var newDom = $(content);
var newTitle = newDom.find("title").text();
console.log(newDom);
console.log(newDom.find(CLASS.MAIN_CONTENT));
console.log(newTitle);
$(CLASS.MAIN_CONTENT).replaceWith(newDom.find(CLASS.MAIN_CONTENT));
});
And this doesn't work, I get the valid content from request but still cannot get any element from new DOM
Here is output of parsed with $(content)
And here is the raw output of the content console.log(content)
What can be wrong, why this doesn't work ?