Question

Je suis à écrire un code à l'aide de Google Ajax-Feed API pour obtenir l'alimentation du site. Voici mon code pour le même.

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google AJAX Feed API - Simple Example</title>
        <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA5MxjlekOJilywavs2TkrKxR3jjpvUIxSLOdaAPuufKrvVh6s1RSHnixBY86Q-Ze6bbbVdDtzvnIORA"></script>
        <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
        <script type="text/javascript">

            google.load("feeds", "1");
            function initialize() {
                feed = new google.feeds.Feed("http://feeds.labnol.org/labnol");
                feed.load(function(result)
                {
                    if (!result.error)
                    {
                        var container = $("#feed");
                        for (var i = 0; i < result.feed.entries.length; i++)
                        {
                            var entry = result.feed.entries[i];
                            var header = $("<h2> <input type=\"checkbox\" name=\"rssItem\" /><span class=\"title\"> "+entry.title+" </span> </h2>");
                            var dataStr = $("<em class=\"date\">"+entry.publishedDate+"</em><p class=\"description\">"+entry.contentSnippet+"</p><a target=\"_blank\" href=\""+entry.link+"\">Read more...</a>");
                            var divObj = $("<div></div>");
                            header.appendTo(divObj);
                            dataStr.appendTo(divObj);
                            divObj.appendTo(container);
                        }
                    }
                });    
            }
            google.setOnLoadCallback(initialize);
    </script>
    </head>
    <body>
        <div id="feed"></div>   
    </body>
</html>

Cela fonctionne parfaitement dans mozilla, mais pas dans IE. Quelqu'un peut-il me dire ce qui se passe mal dans IE?

Était-ce utile?

La solution

problème très étrange, dès que je l'ai changé

feed = new google.feeds.Feed("http://feeds.labnol.org/labnol");

à

var feed = new google.feeds.Feed("http://feeds.labnol.org/labnol");

tout commence à travailler comme prévu dans IE.

Merci de toute façon.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top