1
I created this code at the test level to try to consume a "json" via AJAX. I’d like you to tell me where I’m going wrong I’m getting this mistake:
json.html:1 Xmlhttprequest cannot load http://vagalumewifi.com.br/timeline. Response to preflight request doesn’t pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin 'http://127.0.0.1:49844' is therefore not allowed access.
Follow my code below, thanks in advance!
var jsonTeste = function(){
$(".botao-teste").click(function(e){
e.preventDefault();
$.ajax({
url: "vagalumewifi.com.br/timeline.json",
headers: {'X-Requested-With': 'XMLHttpRequest'},
dateType: "json",
success: function(retorno){
$.each(retorno.timeline, function(){
var conteudo = this;
alert(conteudo.content);
})
}
})
})
};
$(jsonTeste);
The problem is that Voce is making the ajax request for another domain, Voce has access to the http://vagalumewifi.com.br/timeline?
– Euler01
tried to put the
type
asget
?– RFL
The link is public friend
– Anderson Oliveira
I already put "get","json",jsonp and nothing
– Anderson Oliveira
Hi Anderson! I marked the answer as a duplicate of another. Refer to the problem you are having, basically the other domain does not allow external connections. You have to use a proxy (server) or iframe.
– Sergio
Thanks friend!
– Anderson Oliveira