Eu não tenho acesso ao .htaccess do servidor e preciso habilitar o cors no jQuery
O código para acessar o WebService é:
$(document).ready(function(){
jQuery.support.cors = true;
$.ajax({
url: 'https://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote',
crossDomain:true,
dataType: 'text/xml',
success: function(response){
console.log(response);
}
});
});
O request headers é:
Request Headers
:authority:finance.yahoo.com
:method:GET
:path:/webservice/v1/symbols/allcurrencies/quote
:scheme:https
accept:*/*
accept-encoding:gzip, deflate, br
accept-language:pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
origin:http://localhost
referer:http://localhost/biblioteca/cotacao/jQueryYahooFinance/
user-agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36
No .htaccess eu ativaria usando:
Header set Access-Control-Allow-Origin "*"
No php eu ativaria usando:
<?php header('Access-Control-Allow-Origin: *'); ?>