JSFiddle - React, Tailwind, and code Playground

by oroce

HTML

<script src="http://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.js"></script>
<script type="text/jquery-tmpl" id="tmplTweetEntry">
    <tr data-datum="${created_at}">
        <td>
            ${from_user}
        </td>
        <td>
             {{if profile_image_url }}
                 <img src="${profile_image_url}" />
             {{else}}
                 &nbsp;
             {{/if}}
        </td>
        <td>
            ${text}
        </td>
    </tr>
</script>
<table id="tweets">
    <thead>
        <tr>
            <th>Név</th>
            <th>Kép</th>
            <th>Üzenet</th>
        </tr>
    </thead>
    <tbody>
        
    </tbody>
</table>

JavaScript

$( document ).bind( "get-tweets", function(){
    $.ajax({
        url:"http://search.twitter.com/search.json?q=corvinus",
        dataType: "jsonp",
        success:function( data ){
            $( document ).trigger( "got-tweets", data );
        }
    });
});

$( document ).bind( "got-tweets", function(e, data ){
    $( "#tmplTweetEntry" )
                .tmpl( data.results )
                .appendTo( "#tweets tbody" );
    $( "#tweets tbody tr" )
        .click(function(){
            alert( $( this ).data( "datum" ) );
        });
});

$( document ).trigger( "get-tweets" );