I'm trying to get the data via json, but I want to save it in the browser, but I can not if someone can help me follow the code
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags must come first in the head; any other head content must come after these tags -->
<title>Tutorial Web App</title>
<!-- Bootstrap -->
<link href="bootstrap.css" rel="stylesheet">
</head>
<body>
<h1>Listar objetos</h1>
<ul class="list-group">
</ul>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="bootstrap.js"></script>
<script>
$(function(){
var objetos = JSON.parse(window.localStorage.getItem('objetos'))
//window.localStorage.removeItem('objetos')
$.each(objetos, function(index, item){
$('.list-group').append('<li class="list-group-item">'+ item.id + ' ' + item.nome +'</li>')
})
$.get('https://coarinet.com/teste.json')
.done(function(resposta){
// a varivel resposta (pode ser qualquer nome) recebera os dados retornados pela requisicao
// aqui voce faz o que quiser com os dados
// exemplo de laco de repeticao
$.each(resposta, function(indice, item){
// faz algo a cada interaca
$('.list-group').append('<li class="list-group-item">'+ item.id.nome +'</li>')
window.localStorage.setItem('objetos', JSON.stringify(resposta))
})
})
})
</script>
</body>
</html>