<!--热门文章-->
<div class="remenwenzhang">
<div class="news-recommend">
<div class="news-recommend-title">推荐</div>
<ul class="news-recommend-list">
</ul>
</div>
</div>
<script type="text/javascript">
$.ajax({
url: "https://gateway.caixin.com/api/data/cms-data/getPvRank",
type: "get",
dataType: "jsonp",
success: function(res) {
console.log(res);
console.log(typeof(res));
var _data = res.data;
console.log(_data);
var str = '';
// 注意:输出的i与obj分别为下标与单个的对象
$.each(_data, function(i, obj) {
console.log(i);
console.log(obj);
str += '<li>';
str += '<a url="' + obj.link + '"/>';
str += '<span>'+ obj.title + '</span>';
str += '</li>';
});
$(".news-recommend-list").append(str);
}
})
</script>