Which is the function to be called if ONLY the news div is to be refreshed at specific time intervals?

45 views
Skip to first unread message

aravind ajith

unread,
Sep 15, 2015, 2:48:14 PM9/15/15
to Google AJAX APIs
Hi all,

I'm able to display the news feeds in my web page, but it would be very helpful if someone can help me on how to implement the setTimeout function in JS for this API.

ie. I would like to make the API call at specific intervals. So that, the specific div comprising the news is refreshed, and NOT the whole webpage as such.

Which is the function to be called for that??

Jeremy Geerdes

unread,
Sep 15, 2015, 2:52:27 PM9/15/15
to google-ajax...@googlegroups.com

It is almost impossible to offer a meaningful suggestion without being able to see what you're doing with the API. You need to provide a link to your page, working or not.

Also, please be advised that the Feeds API has been officially deprecated, per the documentation, and may be shut down at any time, with or without warning, per the terms of service. It is strongly advised that you NOT utilize the Feeds API for any mission-critical functionality.

Jg

--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-searc...@googlegroups.com
To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/01c941e6-6124-412f-ad1b-7289f04a1604%40googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aravind ajith

unread,
Sep 16, 2015, 2:47:43 PM9/16/15
to Google AJAX APIs
Hi Jg,

It is a web portal whose of the functionalities is to display news feeds in the home page. I am able to change the news type(using JavaScript), and I can also control the no. of news feeds appearing in the we bportal, as the user wishes(There is a specific Settings page in which user can chose what news(From Reuters, Technology News, Business News etc..), also there's an option for no. of news feeds to be displayed which i can access with the help of localstorage along with JS.)
There is also an additional functionality of "Set refresh rate(in seconds)". User can set the refresh rate. And i am able to access the value set too.

Using that, i wanted to keep on refreshing the news feed at that interval. I don't want to reload the whole page then since there are other widgets too. I wanted to refresh only the news widget.
To do this, I THINK, its the function call to be set at that specific interval, so, the div automatically refreshes. Can you please help me on this? (When the user initially signs in to the home page, there's a default news which is displayed, I wanted to customise the refresh rate interval in that.)
Thanks in advance.

Jeremy Geerdes

unread,
Sep 16, 2015, 3:48:33 PM9/16/15
to google-ajax...@googlegroups.com
Allow me to clarify: we need to be able to see the code behind your implementation of the API so that we can answer your question. The Feeds API does not natively include an "auto-refresh" setTimeout method. You have to write that yourself. How you would do it depends on a wide number of variables. It may be something as simple as re-initializing a feed control, or it may be very complex. The best thing you could do would be to post a link to your web portal that we can examine so we can offer suggestions.

jg

--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-searc...@googlegroups.com
To view this message on the web, visit

For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

Jeremy Geerdes

unread,
Sep 16, 2015, 3:49:25 PM9/16/15
to google-ajax...@googlegroups.com
I would also be remiss if I did not reiterate my warning from before: the Feeds API has been deprecated and, according to the Terms of Service, may be shut down at any time. I would strongly advise against utilizing it for mission-critical functionality.

jg

aravind ajith

unread,
Sep 17, 2015, 3:50:32 AM9/17/15
to Google AJAX APIs
<script type="text/javascript">


mydb = openDatabase("ProjectDB", "0.1", "A Database of Users",10 * 1024 * 1024);
mydb.transaction(function(tx) {
            var userid = localStorage.getItem("userid");
            tx.executeSql('SELECT * FROM settings WHERE id=?', [userid], function(tx, results) {

              if(results.rows[0].id==userid){
                localStorage.setItem("newsinfo",results.rows[0].news);
                localStorage.setItem("checking",results.rows[0].weather);



              }

            });
          });

function load() {



var newsinfo = localStorage.getItem("newsinfo");
            var newsdetails = JSON.parse(newsinfo);

var num1 = newsdetails.feednumber;
var newstype = newsdetails.newstype;

var options = {
    numResults : num1
 }
new GFdynamicFeedControl(newstype, "feedControl",options);
}
google.load("feeds", "1");
google.setOnLoadCallback(load);
var newsinfo = localStorage.getItem("newsinfo");
            var newsdetails = JSON.parse(newsinfo);

var dispnews = newsdetails.displaynews;
if(dispnews==true){
//alert("disp news is true");

}else{
$("#newsd").addClass("hide");
alert("disp news is false");
}
</script>


I actually wanted to refresh the news feed automatically at selected intervals. Presently, the user controls the number of news feeds to be displayed.
I am attaching two screenshots, so that you'll get an idea.

Also, I would like to know whether the feedCycleTime function will work.(But when i tried its not working, and its listed as a "ToDo" in the js file.) Is there any way that can be made to work? Can you please help me with this?

And, its for a Demo presentation, that's all. Site is hosted locally.



On Wednesday, September 16, 2015 at 12:18:14 AM UTC+5:30, aravind ajith wrote:
Screenshot from 2015-09-17 11:07:58.png
Screenshot from 2015-09-17 11:07:46.png
Reply all
Reply to author
Forward
0 new messages