I looked at some examples of the jQuery documentation, but I still could not.
Code:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"type="text/javascript"></script>
<script type="text/javascript">
var endereco = 'http://10.20.229.17:8085/todosPostos';
$.ajax({
url: endereco,
complete: function(res){
var data = JSON.parse(res.responseText);
console.log(data);
}
});
</script>
</head>
<form action="testeste.html" method="post">
<select>
<option value="trechoorigem">Trecho (Origem)</option>
<option value="trechodestino">Trecho (Destino)</option>
</select>
<input type="text" />
<button type="button">Pesquisar</button>
</form>
</body>
</html>
Console:
XMLHttpRequest can not load link . In 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Uncaught SyntaxError: Unexpected token u