Jquery 当仅在Safari中读取XML文件时,我有一个ajax兼容性问题
好的,我正在3个不同的浏览器中测试这个 最新的Safari,最新的FireFox和最新的Google Chrome 问题是这个脚本只适用于Safari…有人知道为什么吗Jquery 当仅在Safari中读取XML文件时,我有一个ajax兼容性问题,jquery,ajax,safari,Jquery,Ajax,Safari,好的,我正在3个不同的浏览器中测试这个 最新的Safari,最新的FireFox和最新的Google Chrome 问题是这个脚本只适用于Safari…有人知道为什么吗 <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <script> $.ajax({ type
<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"));
});
}
});
$.ajax({
键入:“获取”,
url:“http://www.nfl.com/liveupdate/scorestrip/ss.xml",
数据类型:“xml”,
成功:函数(xml){
//解释反应
$(xml).find('g').each(function(){
//示例:在控制台中显示XML标记
console.log(this);
//示例:将一些输出放在DOM中
$(“#divOutput”).append($(this.attr(“hnn”));
});
}
});
输出对safari非常有效,但它不会在其他浏览器中输出任何内容。
除非您运行的是
nfl.com
,否则无法跨站点发出AJAX请求
不过,你可能想试试这个
<div id="divOutput"></div>
</body></html>