IE浏览器的AJAX问题

时间:2017-05-31 22:31:59

标签: javascript ajax internet-explorer browser

我有一个网站,其中包含从其他网站RSS Feed填充的内容列表。我正在使用AJAX来显示检索数据并显示它。但由于某种原因,它没有在IE上显示。以下是我使用的代码。

<html>
<head>

</head>
<body>
    <div class="col-md-6">
        <h3><i class="fa fa-fire" aria-hidden="true"></i>LoRa Partners Training</h3>
        <ul><div id="externaltraining"></div></ul>
      </div><!--col -->
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script>
        $(document).ready(function() {
            var feed2 = "http://www.externlsite.com/rss.php";
            var externaltraining = '';
            var extcnt = 0;

            $.ajax(feed2, {
                accepts:{
                    xml:"application/rss+xml"
                },
                dataType:"xml", 
                success:function(data) {
                    alert('Loading');
                    $(data).find("item").each(function () { // or "item" or whatever suits your feed
                        var el = $(this);

                        externaltraining = externaltraining + "<li><h4><a href='"+el.find("link").text()+"' target='_blank' title='"+el.find("title").text()+"'>"+el.find("title").text()+"</a></h4>";
                        externaltraining = externaltraining + "<p>"+ el.find("description").text()+"<br /><a href='"+el.find("link").text()+"' target='_blank' title='"+el.find("title").text()+"'>Register Now</a></p></li>";
                        extcnt = extcnt + 1;
                    });   
                    if (extcnt > 0) { 
                        document.getElementById("externaltraining").innerHTML = externaltraining;
                    }
                    else {
                        document.getElementById("externaltraining").innerHTML = "<br /><p>Sorry!! No content for now. Please check back later.</p>";
                    }                               
                }   
            });
        });
    </script>
</body> 

我使用的是Internet Explorer 11.0.9600.18230

0 个答案:

没有答案