“无法从”错误中获取Feed“

时间:2014-08-04 00:43:07

标签: javascript wordpress rss

我的网站上有一个自动RSS源,它使用Google的API Feed和Javascript从wordpress博客获取更新。附件是我在html中使用的代码。问题是即使博客上有新帖子,自动RSS源也不会更新。该博客列在wordpress博客的RSS源上,但未在我的网站上更新。我认为这是一个缓存问题,所以我尝试在feedurl中添加一个cache-buster,但这只会导致错误“无法从...中获取feed”,即使在浏览器中键入feedurl也会显示RSS feed为wordpress博客。

<article id="feedContainer"></article>

     <script type="text/javascript">

        var feedUrl = "http://businesssocialimpact.wordpress.com/feed?" + (new Date).getTime();

        var feedContainer=document.getElementById("feedContainer");


        $(document).ready(function() {

            var feed = new google.feeds.Feed(feedUrl);
            feed.setNumEntries(1);

var monthNames = [ "January", "February", "March", "April", "May", "June",

"July", "August", "September", "October", "November", "December" ];

            feed.load( function(result) {

               list = "";

                if (!result.error){

                    var posts=result.feed.entries;

                    for (var i = 0; i < posts.length; i++) {

                        list+="<div class='blog-left-column'><img src='images/blog-images/sample-one.jpg'></div><div class='blog-title'>"+"<a href='" + posts[i].link + "'target=_blank'" + ">" + posts[i].title + "</a>" + "</div>" +"<div class='post-description'><p>"+posts[i].contentSnippet+"</p>"+"<p class='read-more'><a href='" + posts[i].link + "'target=_blank'" + "' class='readmore'>" + "Continue Reading >>" + "</a></p>"+"</div>";

                    }

                    list+="";

                    feedContainer.innerHTML = list;

                }

                else {

                    feedContainer.innerHTML = "Unable to fetch feed from " + feedUrl;

                }

            });

        });

    </script>

有没有人有任何想法如何解决错误?任何帮助将不胜感激。

谢谢!

0 个答案:

没有答案