<!doctype html>
<html>
<head>
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
<title>askyb - Load JSON File Locally by Javascript Without JQuery</title>
<script>
fetch('http://127.0.0.1:9000')
.then(
function(response) {
alert( response.status )
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' + response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
alert( data )
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
</script>
</head>
<body onload="load()">
askyb - Load JSON File Locally by Javascript Without JQuery
</body>
</html>
<body>
<script>
fetch('http://127.0.0.1:9000')
.then(
function(response) {
alert( response.status )
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' + response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
alert( data )
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
</script>
</body>
</html>