JSFiddle - React, Tailwind, and code Playground

by Jake Cattrall

HTML

<div id="rss-output">
    <div class="rss-item">
        <div class="rss-date"></div>
        <div class="rss-content">
            <a href=""><h2></h2></a>
        </div>
    </div>
</div>

JavaScript

var RSSSources = [{
    url: 'http://sxp.microsoft.com/feeds/technet/news',
    link: 'link',
    headline: 'title',
    date: 'pubDate',
    sourceTitle: 'Microsoft TechNet'
},{
    url: 'http://www.microsoft.com/en-us/news/rss/rssfeed.aspx?ContentType=PressReleases&Tags',
    link: 'link',
    headline: 'title',
    date: 'pubDate',
    sourceTitle: 'Microsoft TechNet'
},{
    url: 'http://windowsitpro.com/rss.xml',
    link: 'link',
    headline: 'title',
    date: 'pubDate',
    sourceTitle: 'Microsoft TechNet'
},{
    url: 'http://blogs.technet.com/b/microsoft_blog/rss.aspx',
    link: 'link',
    headline: 'title',
    date: 'pubDate',
    sourceTitle: 'Microsoft TechNet'
}];

for(var i = 0; i < RSSSources.length; i++){
    source = RSSSources[i];
    $.ajax({
        url: source.url,
        success: function(response){
            response = $(response);
            response.find('item').each(function(index, elem){
                var title = $(elem).find(source.title).html();
                var headline = $(elem).find(source.headline).html();
                var date = $(elem).find(source.date).html();
                var html = $('.rss-item').clone();
                $(html).find('.rss-date').html(date);
                $(html).find('a').attr('href', link);
                $(html).find('h2').html(title);
                $('#rss-output').html(html);
            });
        }
    });
}