我不确定为什么这不起作用。我想在我的博客页面上显示帖子标题,但我没有显示任何对象。这是我的代码:
$(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){
console.log(data.posts);
alert (data.posts.length);
},
error: function (request,error) {
alert('Network error has occurred please try again!');
}
});
});
这是我的控制台显示的内容:
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
0: Object
1: Object
2: Object
3: Object
4: Object
当我展开第一个对象时,我看到了我想要的不同元素。我如何扩展每个对象以获得所需的输出。