Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6242533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:58:18+00:00 2026-05-24T11:58:18+00:00

I am reading a Rss feed using setInterval method and displaying notification to the

  • 0

I am reading a Rss feed using setInterval method and displaying notification to the users ,I want to make sure I store the latest feed title so that the user does not get multiple notification of the same title again. The current implementation does not work because I cant use that variable until the response comes back. To make things worse I am delaying the execution.So I am guessing I need to use callback function get the value and do my checking inside that function. I am not able to figure out how to do the callback and get the value of entry_title.

/** global variable **/

var global_Rsstitle;

/** end global variable **/

function get_rss1_feeds() {

    var Rss1_title = getRss("http://rss.cnn.com/rss/cnn_topstories.rss", function(entry_title) {
        if(global_Rsstitle != entry_title)
        global_Rsstitle = entry_title;
        console.log('test',global_Rsstitle); // the value is outputed but global var is not working
    });
console.log('test1',global_Rsstitle);   // outputted as undefined ??
    }

    google.load("feeds", "1");
    google.setOnLoadCallback(function () { setInterval(get_rss1_feeds, 5000); });

My jsRss.js

function getRss(url, callback){
    if(url == null) return false;

    // Our callback function, for when a feed is loaded.
    function feedLoaded(result) {
        if (!result.error) {
            var entry = result.feed.entries[0];
            var entry_title = entry.title; // need to get this value
            callback && callback(entry_title);        
        }
    }
    function Load() {       
        // Create a feed instance that will grab feed.
        var feed = new google.feeds.Feed(url);
        // Calling load sends the request off.  It requires a callback function.
        feed.load(feedLoaded);      
    }    
    Load();             
}

can u see the entry_title -> this stores d value i need
so i need to get this value n store it into a global variable
or send it to another fns as a argument
so that I can maintain the value
and when next time setInterval is fired
I get a new value so I can compare and check if its same
n if its same I dont display it to the user

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:58:20+00:00Added an answer on May 24, 2026 at 11:58 am
    google.load("feeds", "1");
    google.setOnLoadCallback(function () {
        var oldTitle = '',
            newTitle = '',
            getRss = function (url, callback) {
                (url) && (function (url) {
                    var feed = new google.feeds.Feed(url);
    
                    feed.load(function (result) {
                        (!result.error && callback) && (callback(result.feed.entries[0].title));
                    });
                }(url));
            };
    
        setInterval(function () {
            getRss(
                'http://rss.cnn.com/rss/cnn_topstories.rss',
                function (title) {
                    newTitle = title;
                    if(oldTitle !== newTitle) {
                        oldTitle = newTitle;
                        console.log('oldTitle: ', oldTitle);
                    }
                    console.log('newTitle: ', newTitle);
                }
            );
        }, 5000);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a Rss feed using setInterval method and displaying notification to the
I'm reading and store a RSS feed in my database.I'm using this code <?php
I am reading a RSS feed into nsmutablearray. i want to search the xml
I'm reading a rss feed using simple code: <?php $homepage = file_get_contents('http://www.forbes.com/news/index.xml'); $movies =
I'm Reading many rss feed and store these data in database in my site.
I'm new to php.I'm reading a RSS feed and store in my database table.
I'm reading and store rss feed in my database ,my requirement is if link
Possible Duplicates: (PHP5) Extracting a title tag and RSS feed address from HTML using
When reading my RSS feed with the Thunderbird feed reader, some entries are duplicated.
I am reading an rss feed and I am binding it to a repeater.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.