Sinceramente, comecei faz pouco tempo nessa área, e eu tô perdido, não estou conseguindo entender porque esse erro continua.
Esse é meu HTML
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<link rel="icon" type="favicon.png"/>
<script rsc="http://code.jquery.com/jquery-2.0.3.min.js" type="text/javascript" ></script>
<script src="Script.js" type="text/javascript" ></script>
<title>Insert title here</title>
</head>
<body onload="carregarCEP()">
<section>
<h1>Endereço Por CEP</h1>
<h2></h2>
<table id = "tabela">
<caption>Agora Sim</caption>
<thead>
<th>cep</th>
<th>address_type</th>
<th>address_name</th>
<th>address</th>
<th>district</th>
<th>city</th>
<th>state</th>
<th>lat</th>
<th>lng</th>
<th>city_ibge</th>
<th>ddd</th>
</thead>
<tbody>
</tbody>
</table>
</section>
</body>
</html>
Meu ajax.php está assim:
<?php
echo json_encode($_POST);
?>
O Erro ta aparecendo no Script.js , logo na primeira linha, eu acho que deve ser alguma coisa com o meu ajax.php, mas eu não estou conseguindo evoluir nessa questão.
function carregarCEP (){ var iten="", url = "https://cep.awesomeapi.com.br/json/54230120"; $.ajax({ url: url, type: "GET", cache: false, dataType: 'json', beforeSend: function(){ $("h2").html("Corregando"); }, error:function(){ $("h2").html("fonte de dados com problemas"); }, sucess: function(retorno){ if (retorno[0].erro) {
$("h2").html(retorno.erro); } else{
for (var i = 0; i < retorno.length; i++) {
iten += "<tr>";
iten += "<td>" + retorno[i].cep +"</td>";
iten += "<td>" + retorno[i].address_type +"</td>";
iten += "<td>" + retorno[i].address_name +"</td>";
iten += "<td>" + retorno[i].address +"</td>";
iten += "<td>" + retorno[i].district +"</td>";
iten += "<td>" + retorno[i].city +"</td>";
iten += "<td>" + retorno[i].state +"</td>";
iten += "<td>" + retorno[i].lat +"</td>";
iten += "<td>" + retorno[i].lng +"</td>";
iten += "<td>" + retorno[i].city_ibge +"</td>";
iten += "<td>" + retorno[i].ddd +"</td>";
iten += "</tr>";
}
$("#tabela tbody").html(iten);
$("h2").html("Carregado"); } } }) }
se for o caso, os senhores podem copiar o código e tentar rodar localmente pra entender melhor, mas de toda forma, segue o print do erro que aparece no meu console
Talvez seja coisa "besta", mas eu tô perdidão.
<script rsc="http://code.jquery.com/jquery-2.0.3.min.js" type="text/javascript" ></script>
deveria ser<script src="http://code.jquery.com/jquery-2.0.3.min.js" type="text/javascript" ></script>
.