我正在尝试使用 $.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"); });