JSFiddle - React, Tailwind, and code Playground

by dafin defandaky

HTML

<div id="result">Loading...</div>

JavaScript

$(function() {
    $.ajax({
        url: 'http://defandaky.blogspot.com/feeds/posts/summary?alt=json-in-script',
        type: 'get',
        dataType: 'jsonp',
        success: function(data) {
            var link, title, skeleton = '',
                content = data.feed.entry;
            if (content !== undefined) {
                skeleton = "<ol>";
                for (var i = 0; i < content.length; i++) {
                    title = content[i].title.$t;
                    for (var j = 0; j < content[i].link.length; j++) {
                        if (content[i].link[j].rel == "alternate") {
                            link = content[i].link[j].href;
                            break;
                        }
                    }
                    skeleton += '<li><a href="' + link + '">' + title + '</a></li>';
                }
                skeleton += '</ol>';
                $('#result').html(skeleton);
            } else {
                $('#result').html('<span>No result!</span>');
            }
        },
        error: function() {
            $('#result').html('<strong>Error Loading Feed!</strong>');
        }
    });
});