JSFiddle - React, Tailwind, and code Playground
by tea4two
HTML
<?php
$xml = simplexml_load_file('http://feedblog.ameba.jp/rss/ameblo/toucher-salon/rss20.xml');
$json = json_encode($xml);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id="disp"></div>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
var $json = <?php echo $json; ?>;
console.log($json);
$(function(){
$items = $json.channel;
console.log( $items );
$html = '';
$.each($items, function(i, item){
var date = new Date(item.pubDate);
var time = date.getFullYear() + '年' + date.getMonth() + '月' + date.getDate() + '日';
$html = '<a href="' + item.link + '">' + '<time>' + time + '</time>' + item.title + '</a><br>';
});
$('#disp').html($html);
});
</script>
</body>
</html>