<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Alura Typer</title>
<link rel="stylesheet" href="css/libs/materialize.min.css">
<link rel="stylesheet" href="css/libs/google-fonts.css">
<link rel="stylesheet" href="css/estilos.css">
</head>
<body>
<div class="container">
<h1 class="center">Alura Typer</h1>
<p class="frase center">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<ul class="informacoes center">
<li>
<i class="small material-icons icones">description</i>
<span id="tamanho-frase">5</span> palavras
</li>
<li>
<i class="small material-icons icones">query_builder</i>
<span id="tempo-digitacao">10</span> segundos
</li>
</ul>
<textarea class="campo-digitacao" rows="8" cols ="40"></textarea>
<div class="botoes">
<a id="botao-reiniciar" class="btn-floating btn-large waves-effect waves-light red">
<i class="material-icons">restore</i>
</a>
<a id="botao-placar" class="btn-floating btn-large waves-effect waves-light green">
<i class="material-icons">assignment</i>
</a>
<a id="botao-frase" class="btn-floating btn-large waves-effect waves-light blue">
<i class="material-icons">shuffle</i>
</a>
</div>
<ul class="center">
<li><span id="contador-caracteres">0</span> caracteres</li>
<li><span id="contador-palavras">0</span> palavras</li>
</ul>
<section class="placar">
<h3 class="center">Placar</h3>
<table class="centered bordered">
<thead>
<tr>
<th>Nome</th>
<th>No. de palavras</th>
<th>Remover</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</section>
</div>
<script src="js/jquery.js"></script>
<script src="js/materialize.min.js"></script>
<script src="js/main.js"></script>
<script src="js/placar.js"></script>
<script src="js/frase.js"></script>
</body>
</html>
$("#botao-frase").click(fraseAleatoria);
function fraseAleatoria() {
$.get("http://localhost:3000/frases", trocaFraseAleatoria);
}
function trocaFraseAleatoria(data) {
var frase = $(".frase");
var numeroAleatorio = Math.floor(Math.random() * data.length);
frase.text(data[numeroAleatorio].texto);
}
estou com esse erro no console quando clico no botão para mudar a frase e a frase não muda, eu baixei o arquivo zip e fiz as mudanças conforme a aula.
principal.html:1 XMLHttpRequest cannot load http://localhost:3000/frases. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.