我有以下 js 脚本和 html 代码,并想在页面上输出结果。当我在控制台中运行它时,我可以看到如下结果:
[对象{标题=“他们没有鞠躬;他们没有烧”,链接=“http://xxxxxxx.com/bow-burn/”,作者=“管理员”,更多...},对象{ title="你上一次在你生活中的蚂蚁领域是什么时候?", link="http://xxxxxxx...significant-areas-life/", author="Admin", more...}, Object { title="婚姻是光荣的...", link="http://xxxxxxx...arriage-honourable-all/", author="Admin", more...}, Object { title="住宅在上帝的堡垒中”,link="http://xxxxxxx...elling-strongholds-
html代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src="css/style.css"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<div id="blog" data-role="page">
<div data-role="header" class="sys_hd" data-position="fixed" data-id="sys_header" >
<h1>Sysads Posts</h1>
</div><!-- header -->
<div data-theme="c" data-role="content" id="postlist"> </div><!-- content -->
<div data-role="footer" data-position="fixed" data-id="sys_footer" >
<div data-role="navbar" >
<ul>
<li><a href="#blog" class="sys_ft">Home</a></li>
<li><a href="#blog" class="sys_ft">Disclaimer</a></li>
</ul>
</div><!-- navbar -->
</div><!-- footer -->
</div><!-- page -->
</body>
</html>
js代码:
$(document).ready((function(){
url = 'http://xxxxxxxx.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(xml){
postlist = xml.responseData.feed.entries;
console.log(postlist);
}
});
}));