I'm trying to build rss feed in jQuery without using any plugin and I found a solution here: designshack.net it uses Google Feed API which is no more in use. I found the solution quite easy but it isn't working. All I'm looking for is a RSS feed that parses JSON response from other blogs/sites using jQuery without any plugin.
also attaching fiddle link.
code is here:
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html">
<title>Automated jQuery RSS Feed Demo</title>
<link rel="stylesheet" type="text/css" media="all" href="css/styles.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="js/parser.js"></script>
</head>
<body>
<div id="topbar"><a href="http://designshack.net">Back to Design Shack</a></div>
<div id="w">
<div id="content">
<h1>Automated jQuery RSS Feed Listing</h1>
<div id="nouperss" class="feedcontainer"></div>
<hr>
</div><!-- @end #content -->
</div><!-- @end #w -->
<script type="text/javascript">
$(function(){
// running custom RSS functions
parseRSS('http://www.noupe.com/feed/', '#nouperss');
});
</script>
</body>
</html>
parser.js (jQuery)
/**
* parses any RSS/XML feed through Google and returns JSON data
* source: http://stackoverflow.com/a/6271906/477958
*/
function parseRSS(url, container) {
$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
success: function(data) {
//console.log(data.responseData.feed);
$(container).html('<h2>'+capitaliseFirstLetter(data.responseData.feed.title)+'</h2>');
$.each(data.responseData.feed.entries, function(key, value){
var thehtml = '<h3><a href="'+value.link+'" target="_blank">'+value.title+'</a></h3>';
$(container).append(thehtml);
});
}
});
}
/**
* Capitalizes the first letter of any string variable
* source: http://stackoverflow.com/a/1026087/477958
*/
function capitaliseFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
*css not attached. tell me if needed