0
我有以下.js代码,但是当我测试该网站时,它只显示每个内容中看到的字词,但没有内容。我想实现的到底是能够显示5个员额,并在底部添加一个链接以显示更多mosts:使用FOR循环时未显示博客文章
$(document).ready(function(){
url = 'http://hopexxx.com/category/daily-devotion/feed/';
$.ajax({
type: "GET",
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
error: function(){
alert('Unable to load feed, Incorrect path or invalid feed');
},
success: function(data){
var postlist = data.responseData.feed.entries;
var html = '<ul data-role="listview" data-filter="true">';
for (var i = 0; i < 5; i++) {
html += '<li>';
html += '<a href="#">';
html += '<div class="entry">entry.title</div>';
html += '<div class="entry">author</div>';
html += '<div class="entry">publishedDate</div>';
html += '<div class="entry">contentSnippet</div>';
html += '</a>';
html += '</li>';
}
html += '</ul>';
$("#postlist").append(html);
$("#postlist ul[data-role=listview]").listview();
}});
});
谢谢有效的rusmus。我是否需要创建另一个js,以便在点击时加载每个帖子的内容,而无需在主网站上显示其他页面内容 –
我不太确定你在问什么。你可能应该创建一个新的问题,并在那里添加相关的html和js。 – rusmus