$j(".news-and-insight-filter-wrapper .tab-list ul li a").on("click", function(){ var getId = $j(this).data("id"); console.log(getId); $j(".news-and-insight-filter-wrapper .tab-list ul li").removeClass("active"); $j(this).parent().addClass("active"); $j('html,body').animate({scrollTop: $j(".news-and-insight-feed[data-id="+getId+"]").offset().top},'slow'); }); let _year = _category = "*"; $j(".news-and-insight-feed-link").on("click",function(e){ e.preventDefault(); let _guid = $j(this).data("guid"); $j(".news-feed-content-wrapper").empty(); $j("body").addClass("activeNews"); $j("html, body").stop().animate({scrollTop:0}, 500, 'swing', function() { }); const xml = $j(this).parents(".news-and-insight-feed").data("feed"); const xhr = new XMLHttpRequest(); xhr.open("GET", xml, true); xhr.send(); xhr.onreadystatechange = function (data) { if (this.readyState == 4 && this.status == 200) { let json = $j.xml2json(this.response); console.log(json); let jsonAsString = JSON.stringify(json, null, 2); json.channel.item.forEach((obj, count) => { const formattedDate = moment(obj.pubDate).format('DD MMM yyyy'); if (obj.guid.includes(_guid)) { let detailDataWrapper = $j(".news-feed-content-wrapper"); const newsDetail = { title: obj.title.toString(), date: formattedDate, image: obj.imageOriginal.toString(), content: obj.boilerplate, description: obj.description, encoded: obj.encoded }; console.log(obj.title.toString()); const htmlDataMarkup = ` Close news data section
${newsDetail.date}