<html>
<head>
<title>js fetch</title>
</head>
<body>
<script>
document.addEventListener('DOMContentLoaded', function () {
fetch('api/', {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(response => response.json().then(result => console.log(result)));
//.then(response => console.log(response.json()));
});
</script>
</body>
</html>
Olá Pessoal!
Por quê a linha comentada(linha 16) não funciona?
Enquanto a 15 funciona.