0
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Teste - LOTECE</title>
</head>
<body>
<div class="resultado"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('.resultado').load('http://www.lotece.com.br/v2/ .dataResultado');
});
</script>
</body>
</html>
I have the above code, but the problem of not listing the results has to do with cross-origin. I’m a beginner in a lot of things and I don’t know how to solve this problem. At first it was supposed to be this, when accessed localhost/Test.html.
I would appreciate it if you would help me solve this problem. [I don’t even know where to start, rs]
You are accessing your
Teste.html
from a local server or by uploading the file directly (file://.../Teste.html
)? can post console error?– mrlew
Is this domain lotece.com.br yours? It’s the one that needs to free the access, if it’s not in your control there’s no way.
– bfavaretto
If it is just to test ajax, you should start your Chrome with the argument: -disable-web-security . This will work just for you or whoever starts Chrome with it. If you are going to use different domains when the system is in production (multiple people using), you will have to release in the application hosted in lot.com.br
– Hugo Lima
At first I only stopped the file [I opened on Chrome] @bfavaretto . Lotece.com.br is the domain I want to pull the results and an external website.
– CRISLANIO
@Hugolima the intention was to make an application that showed the results. I don’t know how to do this on the server either. Users would access and see the results of lot.com.br.
– CRISLANIO
As well pointed out by @bfavaretto, the CORS protection is on the server side. There’s nothing to do. One suggestion is to create a script in your application (php, Node...) that acts as a proxy. This would allow you to access this page with AJAX.
– mrlew
Srs @Hugolima mrlew bfavaretto then change my question and ask how to get the results of www.lotece.com.br/v2/ and list on a page ? In a simple way. Att
– CRISLANIO
Ask another question @CRISLANIO. This one has already been answered.
– ShutUpMagda
You are not accessing a server on the localhost, but in batch.com.
– mau humor