1

我正在尝试使用 $.get 方法从该 Web 服务获取 xml 数据: http ://www.webservicex.net/currencyconvertor.asmx?op=ConversionRate

当我尝试获取数据时出现错误。

示例代码:

var FromCurrency = "USD";
var ToCurrency = "JMD";
var url = "www.webservicex.net/currencyconvertor.asmx/ConversionRate?FromCurrency="+FromCurrency+"&ToCurrency="+ToCurrency;
var jqXHR;

alert(url);
jqXHR = $jQuery.get(url,function(data){
    alert(data);
})
.success(function() { alert("second success"); })
.error(function() { alert("error"); })
.complete(function() { alert("complete"); });


// Do something here

// Set another completion function for the request above
jqXHR.complete(function(){ alert("second complete"); });
4

1 回答 1

2

经典的同源政策

您可以使用此 jsFiddle 查看此处重现的错误:http: //jsfiddle.net/AWW2S/1/

于 2012-09-29T14:26:57.293 回答