Page 1 of 1

How to update the list of blogs asynchronously in RSS FEED??

Posted: Sun Jun 13, 2010 10:35 am
by amitdubey2
Hello all,

I am creating a web application using Google AJAX Feed API to display 5 latest blog titles from a website.
The code which i am using is following -(The key which i used in this is for directory " localhost/rss/ ")

Code: Select all

<form action="" method="get">
How many feeds you want to show ??
<br />
<input type="text" name="x"value="" size="1" maxlength="2">
<br />
<input type="submit" value="submit">
</form>
<?php
$x=$_GET['x'];
?>
<html> 
  <head> 
    <script  type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAv5uCBbSj0o9kkU3g2mXJThROC4bvNdgYBpkrp5Ijzw2YwsWbFxScFdgIEHgetqZJBTE81deWlOy71Q"></script> 
    <script type="text/javascript"> 
 
      google.load("feeds", "1"); 
 
      var defaultQuery = 'Webyog';
      function findFeeds(query) { 
        google.feeds.findFeeds(query, feedSearchDone); 
      } 
 
      function feedSearchDone(result) { 
        var el = document.getElementById('feedControl'); 
 
        if (result.error || result.entries.length <= 0) { 
          el.innerHTML = 'No Results Found'; 
          return; 
        } 
 
        // Create a feed control 
        var feedControl = new google.feeds.FeedControl(); 
 
        // Grab top 4.. 
        for (var i = 0; i < <?php echo $x ;?> ; i++) { 
          feedControl.addFeed(result.entries[i].url, result.entries[i].title); 
        } 
 
        feedControl.setLinkTarget(google.feeds.LINK_TARGET_BLANK); 
        feedControl.setNumEntries(1); 
        feedControl.draw(el); 
      } 
 
      google.setOnLoadCallback(function() {findFeeds(defaultQuery)}); 
 
    </script> 
  </head> 
 
  <body> 
    <div id="feedControl">Loading</div> 
  </body> 
</html>




But the thing is i want that application should update the list of blogs asynchronously at every user-specified interval of time.I am not getting any idea about this ...any suggetion will be wonderful ??? :dubious: :dubious:


regards
amit

Re: How to update the list of blogs asynchronously in RSS FE

Posted: Sun Jun 13, 2010 6:47 pm
by Jonah Bron
Just put all of that javascript into a function, and then use setInterval().

Re: How to update the list of blogs asynchronously in RSS FE

Posted: Mon Jun 14, 2010 7:28 am
by katierosy
Yes : you may use jquery along with the set interval and see if it works, You can write setInterval(funname(),100) on

<script src="jquery.js"></script>

<script>
$(document).ready(function(){
setInterval(funname(),100)
});

function funname(){
// do refresh part here
}
</script>

Re: How to update the list of blogs asynchronously in RSS FE

Posted: Tue Jun 15, 2010 3:34 am
by amitdubey2
hello katierosy ,

i tried it in several ways but not getting the things correctly..Actually i dont know much about javascript so, Can you please modify the above code and set the interval to 30 min for checking update feeds for that blog.
Please help me.. :idea: :dubious:




regards
amit