我在本地系统中有一个 xml 文件。我可以使用在 IE 和 Firefox 上运行的 jquery 读取该文件,但我无法使用 Chrome 和 Opera 读取该文件。问题出在哪里?
<!DOCTYPE html>
<html>
<head>
<title>AJAX </title>
<script type="text/javascript" src="jq.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
$.support.cors = true;
$.ajax({
type: "GET",
//crossDomain: true,
//contentType: "application/xml",
contentType: "application/xml;charset=UTF-8",
url: "YYYYAAGGu.xml",
//url: "today10.xml",
cache: false,
dataType: "xml",
success: function(xml) {
$(xml).find('Currency').each(function(){
var name = $(this).find("Isim").text()
alert(name);
});
},
error: function(xhr, status, error) {
alert("An error occured: " + status + "\nError: " + error);
}
});
});
</script>
</body>
</html>