I am trying to fetch HTML of a specific ULR. I want to grab specific class from there .
This is the full code.
(function () { try { /*----------------------- section data -----------------------*/ var FeHelper = this; //wait for element to load FeHelper.doWhenElementLoaded = function ( selector, trigger, delayInterval, delayTimeout ) { var interval = setInterval(function () { if ( document && document.querySelectorAll(selector) && document.querySelectorAll(selector).length > 0 ) { clearInterval(interval); trigger(); } }, delayInterval); setTimeout(function () { clearInterval(interval); }, delayTimeout); }; /*----------------------- init is the main controller --------------------*/ FeHelper.solve = function(data){ console.log(data); console.log(data.querySelector(".twitter-cards.slick-initialized.slick-slider")); } FeHelper.init = function () { var xhr = new XMLHttpRequest(); xhr.onload = function() { FeHelper.solve(this.responseXML); } xhr.open('GET', 'https://www.generationgenius.com/about/', true); xhr.responseType = "document"; xhr.send(); }; FeHelper.doWhenElementLoaded('body', FeHelper.init, 50, 10000); } catch (err) { // console && console.log(err); } })();
2.1m questions
2.1m answers
60 comments
57.0k users