Created
July 9, 2021 19:45
-
-
Save johnny12150/c27c1f81a297ea9bc578a7f96bf801ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Load CDC API</title> | |
</head> | |
<body> | |
</body> | |
<script> | |
// https://ithelp.ithome.com.tw/articles/10244631 | |
// https://data.gov.tw/dataset/120711 | |
// const dataset_url = 'https://od.cdc.gov.tw/eic/Day_Confirmation_Age_County_Gender_19CoV.json'; | |
// 用proxy避免CORS, https://github.com/Rob--W/cors-anywhere/ | |
// const dataset_url_cors = 'https://cors-anywhere.herokuapp.com/https://od.cdc.gov.tw/eic/Day_Confirmation_Age_County_Gender_19CoV.json'; | |
function get_data(){ | |
fetch('https://raw.githubusercontent.com/typicode/demo/master/db.json') | |
.then(function(response) { | |
return response.json(); | |
}) | |
.then(function(myJson) { | |
console.log(myJson); | |
}); | |
} | |
get_data() | |
</script> | |
</html> | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Load CDC API</title> | |
</head> | |
<body> | |
</body> | |
<script> | |
// https://ithelp.ithome.com.tw/articles/10244631 | |
// https://data.gov.tw/dataset/120711 | |
// const dataset_url = 'https://od.cdc.gov.tw/eic/Day_Confirmation_Age_County_Gender_19CoV.json'; | |
// 用proxy避免CORS, https://github.com/Rob--W/cors-anywhere/ | |
// const dataset_url_cors = 'https://cors-anywhere.herokuapp.com/https://od.cdc.gov.tw/eic/Day_Confirmation_Age_County_Gender_19CoV.json'; | |
function get_data(){ | |
fetch('https://raw.githubusercontent.com/typicode/demo/master/db.json') | |
.then(function(response) { | |
return response.json(); | |
}) | |
.then(function(myJson) { | |
console.log(myJson); | |
}); | |
} | |
get_data() | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment