Total members 11890 |It is currently Tue Apr 16, 2024 8:10 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Read RSS feeds of any website and parse it with JQuery then print it into your webpage
javascript code
<html>
<head>
<title>Parse RSS feeds, load RSS.xml files</title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script type="text/javascript" src="./jFeed/build/dist/jquery.jfeed.pack.js"></script>
<script>

$(document).ready(function(){
$("button#btn1").click(function(){
loadRSS();
});
function loadRSS(){

$.getFeed({
// Note here we use php page and send the the URL to it as parameter.
url: 'getRSS.php?url=http://www.codemiles.com/rss.php',
success: function(feedObj) {

//Title and link
$('#RSSFeeds').append('<h1><a href="' + feedObj.link + '">' + feedObj.title + '</a>' + '</h1>');

//Print the list of feeds as read.
var contentRSS = '<ul>';

$(feedObj.items).each(function(){
var $singleFeed = $(this);

contentRSS += '<li>' +
'<h2><a href ="' + $singleFeed.attr("link") + '" >' + $singleFeed.attr("title") + '</a></h2> ' +
'<p>' + $singleFeed.attr("description") + '</p>' +
'<p>' + $singleFeed.attr("c:date") + '</p>' +
'</li>';
});

contentRSS += '</ul>';

$('#RSSFeeds').append(contentRSS);
}
});
}
});

</script>
</head>
<body>

<div id="RSSFeeds" ></div>
<button id="btn1">Load Feeds</button>
</body>
</html>


This JQuery call getRSS.php:
php code
<?php
// Get URL parameter value
if (!isset($_REQUEST["url"])) exit;

$url = $_REQUEST["url"];
// make sure that HTTP part exists.
if (substr($url, -0, 7) != "http://") exit;

echo file_get_contents($url);
?>



To download JFeeds
Attachment:
File comment: JFeeds
jfeed.zip [45.49 KiB]
Downloaded 692 times

or from its original source :
Code:
http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Load RSS feeds and parse it with JQuery
 Load tweets using JQuery     -  
 Load Content to Tabs using AJAX and JQuery     -  
 Load file and update content using AJAX and JQuery     -  
 Parsing ATOM feeds     -  
 Parsing and Reading RSS feeds     -  
 parse XML file using SAX     -  
 Web scraping and Parse using java... plz help i really need.     -  
 Parse XML using DOM file and run XPath query     -  
 Parse URL in java get Protocol,File,Reference,Host and Port     -  
 load class to applet- load frame class to applet     -  



Topic Tags

JQuery GET/POST
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com