我正在尝试从这个url中获取xml数据
http://www.rabodirect.com.au/includes/figures.xml
以下是我的简单代码:
$(document).ready(function ()
{
$.ajax({
url: 'http://www.rabodirect.com.au/includes/figures.xml',
type: 'GET',
dataType: 'xml',
timeout: 10000,
error: function () {
alert('Error loading XML document');
},
success: function(xml)
{
alert(xml);
}
});
});但会出现错误警报。
有什么想法吗,为什么我不能获得xml数据?
谢谢
发布于 2012-10-10 17:57:22
您的示例给出了“无传输”错误。使用ajax访问外部资源是不可能的。您应该调用一个本地url,它获取并返回数据。参见关于http://api.jquery.com/jQuery.get/的讨论
https://stackoverflow.com/questions/12816477
复制相似问题