In jQuery I wrote this simple ajax call to convert from one currency to another using Yahoo's YQL service.
function changeCurrency(amount, currency_from, currency_to) {
var query = "select%20*%20from%20yahoo.finance.xchange%20where%20pair='" + currency_from + currency_to + "'";
var urlservice = "http://query.yahooapis.com/v1/public/yql?q=" + query + "&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
$.ajax({
type: "GET",
url: urlservice,
dataType: "xml",
success: function(xml) {
$(xml).find('rate').each(function() {
var rate = $(this).find('Rate').text();
var result = Math.round(amount * rate * 100) / 100 ;
$("#result").html(result + currency_to);
});
},
error: function(xhr, status, error) {
$.jGrowl(xhr + ' ' + status + " " + error);
}
});
}
Heres a live version at jsfiddle.
Its working fine in Chrome, FF and Safari but fails in IE (9) with error message "Access denied". I guess it has to do with security but don't know how to solve it, any suggestions?