开发者

I have a ajax compatibility question when reading from an XML file works in Safari only

开发者 https://www.devze.com 2023-03-27 07:14 出处:网络
Ok I am testing this in 3 different browsers... The lastest Safari, the latest FireFox and the latest Google Chrome...

Ok I am testing this in 3 different browsers...

The lastest Safari, the latest FireFox and the latest Google Chrome...

Problem is this script only works for Safari...anyone know why?

<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

<script>

$.ajax({
    type: "GET",
    url: "http://www.nfl.com/liveupdate/scorestrip/ss.xml",
    dataType: "xml",
    success: function(xml) {
        // Interpret response
        $(xml).find('g').each(function() {

            // 开发者_运维知识库Example: Show the XML tag in the console
            console.log(this);

            // Example: Put some output in the DOM
            $("#divOutput").append($(this).attr("hnn"));

        });
    }
});

The output works perfectly for safari yet it won't output anything in the other browsers.

<div id="divOutput"></div>

</body></html>


Unless you're running on nfl.com, you can't make AJAX requests cross-site.

You might want to try this RSS reading jquery plugin, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消