Contoh kode JQUERY Blogger :
<div class='recent-post'></div>
<script>
var FEED_URL="http://folklore-lover.blogspot.com/feeds/posts/summary?max-results=10&alt=json-in-script";
//atau (label) var FEED_URL="http://www.revolusiilmiah.com/feeds/posts/default/-/Pertanian?max-results=1&alt=json-in-script";
//var FEED_URL="http://text-narrative.blogspot.com/feeds/posts/default?max-results=1&alt=json-in-script";
$.ajax({
type: 'GET',
url: FEED_URL,
async: false,
contentType: "application/json",
dataType: 'jsonp',
success: function (json) {
for (var i = 0; i < json.feed.entry.length; i++) {
for (var j = 0; j < json.feed.entry[i].link.length; j++) {
if (json.feed.entry[i].link[j].rel == 'alternate') {
var postUrl = json.feed.entry[i].link[j].href;
break;
}
}
var postTitle = json.feed.entry[i].title.$t;
var postFinal = json.feed.entry[i].summary.$t;
//full content var postFinal = json.feed.entry[i].content.$t;
var item = '<div class="wrapper"><h3><a href=' + postUrl + '>' + postTitle + '</h3></a><p>' + postFinal + '</p></div>';
$(item).appendTo('.recent-post');
}
}
});
</script>
CONTOH LAIN :
<div id="result">Loading...</div>
<script>
$(function() {
$.ajax({
url: 'http://dte-feed.blogspot.com/feeds/posts/summary?alt=json-in-script&max-results=2',
type: 'get',
dataType: 'jsonp',
success: function(data) {
var link, title, skeleton = '',
content = data.feed.entry;
if (content !== undefined) {
skeleton = "<ol>";
for (var i = 0; i < content.length; i++) {
title = content[i].title.$t;
for (var j = 0; j < content[i].link.length; j++) {
if (content[i].link[j].rel == "alternate") {
link = content[i].link[j].href;
break;
}
}
var thumb = 'media$thumbnail' in content[i] ? '<img src="' + content[i].media$thumbnail.url + '">' : "";
var summary = content[i].summary.$t;
skeleton += '<li>'+thumb+'<br/><a href="' + link + '">' + title + '</a><br/>'+summary+'<br/><br/>';
skeleton += '</li>';
}
skeleton += '</ol>';
$('#result').html(skeleton);
} else {
$('#result').html('<span>No result!</span>');
}
},
error: function() {
$('#result').html('<strong>Error loading feed!</strong>');
}
});
});
</script>
Smoga bermanfaat.....!
ConversionConversion EmoticonEmoticon