I have a ajax compatibility question when reading from an XML file works in Safari only
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.
精彩评论