6
I found a Lottery API that brings me the data of the result of a Lotofácil draw, but I am not able to access the data of the JSON object.
I’m trying this way:
$(document).ready(function(){
$.get( "http://developers.agenciaideias.com.br/loterias/lotofacil/json", function( data ) {
$( ".result" ).html( data );
alert( "Load was performed." );
});
});
But the browser console shows me this error:
Xmlhttprequest cannot load http://developers.agenciaideias.com.br/loterias/lotofacil/json. In the 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.
When I directly access the URL I download the JSON file normally, then I would like to know what this error is about and how to make the right call to receive this data.
you tried using jsonp ?
– thiago.adriano26
I read about it, but I was in doubt in the implementation because I only saw example with POST and not with GET.
– Joao Paulo
With jsonp it can access but from the other error: Uncaught Syntaxerror: Unexpected token : Developers.agenciaideias.com.br/lotteries/lotofacil/json? callback=jQuery1110... 82617&_=14141731373&callback=jQuery111003546048323623836_14141731372:1
– Joao Paulo
I was testing several methods the other day to get around this limitation and I even found one that worked on some websites. As it did not work on the site I wanted, I left aside; I think it was using a proxy of Yahoo. I will try to locate here.
– brasofilo