fetch('https://facejsonserver.000webhostapp.com/data.json ')
.then((response) => {
return response.json();
})
.then((data) => {
console.log(data);
});
<?php
$filename = "data.json";
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");
if (file_exists($filename)) {
print(file_get_contents($filename));
} else {
print(json_encode([]));
}
?>