Hello
I know there are several questions on this subject, but even reading the answers I still have problems. I've tried to put Access-Control-Allow-Origin in the header of the .php file, I've already tried putting it in the configuration of virtualhost in Apache and nothing seems to work. Where am I going wrong?
I've already seen that if I use an extension or disable browser flags, it works. So maybe it's something I'm missing from the client side? :
Requisição cross-origin bloqueada: A política de mesma origem (Same Origin Policy) impede a leitura do recurso remoto em https://a.4cdn.org/wsg/1.json. (Motivo: o cabeçalho CORS 'Access-Control-Allow-Origin' não está presente).
<html>
<head>
<link rel="stylesheet" href="css/trend.css">
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
</head>
<body>
<div class="trendings">
<h3>Trending:</h3>
<div>
<ol id="trending">
</ol>
</div>
</div>
<script>
$(document).ready(function(){
var node,textnode,a,btn;
$.getJSON("https://a.4cdn.org/wsg/1.json", function(json) {
for(var i = 1; i < json.threads.length; i++){
node = document.createElement("li");
a = document.createElement('a');
textnode = document.createTextNode(json.threads[i].posts[0].sub);
a.appendChild(textnode);
a.href="http://boards.4chan.org/wsg/thread/"+json.threads[i].posts[0].no;
document.getElementById("trending").appendChild(node).appendChild(a);
}
});
});
</script>
</body>
</html>