I'm working on an rss feed displayer for a webpage. I cant use PHP or Google API's. But can use Javascript, HTML and such. I created some code before but that used Google API's. I can't find a way how to use the code without Google API's. Here is the code that i used before:
<script type="text/javascript">
$(function(){
var feedUrl = 'www.feed.com' + 'feed'; //Example
var postsToShow = 3;
$.ajax({
type: 'GET',
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + postsToShow + '&callback=?&q=' + encodeURIComponent(feedUrl),
dataType: 'json',
success: function(xml){
if(xml.responseData == null){
alert('Unable to load feed, Incorrect path or invalid feed');
}
else
{
values = xml.responseData.feed.entries;
console.log(values);
for(var i = 0; i < postsToShow; i++){
if(i >= values.length){
break;
}
var title = values[i].title;
var content = values[i].contentSnippet;
var link = values[i].link;
if(title != null && content != null && link != null){
$('<a>',{
id: 'wpPostTitle' + i,
class: 'wpPostTitle',
title: title,
href: link,
text: title
}).appendTo('#wpFeed');
$('<p>',{
id: 'wpPostContent' + i,
class: 'wpPostContent',
title: title,
html: '<a href="' + link + '" id="wpPostContent' + i + '" class="wpPostContentLink">'+ content + '</a>'
}).appendTo('#wpFeed');
}
}
}
},
});
});
</script>