I am trying to clone a div from a dynamically generated pages to another page using Ajax, and I keeping getting "null" as a result.
Here is the chain of pages: Home -> MainCat -> SubCat1 -> SubCat2 -> FinalProd
I need to clone a div from the MainCat and append it to the FinalProd page.
Here the Ajax function:
function bodyClass(div) {
var catName = $('#location').children().eq(4).text(),
rootPar = ('root.com/MainCat/'),
banner = $('#divToBeCloned').clone().html();
$.ajax({
type: "GET",
url: rootPar,
dataType: 'html',
data: {param: div},
success: function(html){
console.log(banner);
}
});
}
bodyClass();
In addition, I also get 4 of the same error:
GET chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js net::ERR_FAILEDOj @ www-embed-player.js:632Pj @ www-embed-player.js:633(anonymous function) @ www-embed-player.js:633Oj.c.onerror @ www-embed-player.js:631
If I console log the different variables outside the Ajax call, I get what i need in terms of the correct url and the #divToBeCloned content. What is it that I'm missing in the Ajax?
Thank you.