0
我試圖將我的JSON數據追加到內容頁面,但數據未加載。當我使用console.log時,我可以看到顯示的數據。JSON數據未加載到內容頁面
JS:
$(document).on('pagebeforeshow', '#blogposts', function() {
//$.mobile.showPageLoadingMsg();
$.ajax({
url: "http://howtodeployit.com/category/daily-devotion/?json=recentstories&callback=",
dataType: "json",
jsonpCallback: 'successCallback',
async: true,
beforeSend: function() { $.mobile.showPageLoadingMsg(true); },
complete: function() { $.mobile.hidePageLoadingMsg(); },
success:function(data){
$.each(data.posts, function(i, val) {
console.log(val.title);
$('<li/>').append([$("<h3>", {html: val.title}),$("<p>", {html: val.excerpt})]).wrapInner('<a href="#devotionpost" onclick="showPost(' + val.id + ')"></a>').appendTo('#postList');
return (i !== 4);
console.log('#postlist');
});
},
error: function(data) {
alert("Data not found");
}
});
});
HTML:
<!-- Page: Blog Posts -->
<div id="blogposts" data-role="page">
<div data-role="header" data-position="fixed">
<h2>My Blog Posts</h2>
</div><!-- header -->
<div data-role="content">
<ul id="postlist"> </ul><!-- content -->
</div>
<div class="load-more">Load More Posts...</div>
</div><!-- page -->
你在開玩笑我,再次愚蠢的我,沒有看到首都'L'... – Chelseawillrecover