diff options
author | Jacob Janzen <jjanzenn@proton.me> | 2024-04-28 15:42:23 -0500 |
---|---|---|
committer | Jacob Janzen <jjanzenn@proton.me> | 2024-04-28 15:42:23 -0500 |
commit | d843b6051a790d870f021c2f1c60eeebd93ae1b6 (patch) | |
tree | 9b835e0322b66ae266c03cc0611731777f7ec4bf /scripts/webring.js | |
parent | 5d7c1b955b4d7632f667b9d28e6dfcebc2e1dbec (diff) |
try fetch api
Diffstat (limited to 'scripts/webring.js')
-rw-r--r-- | scripts/webring.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/scripts/webring.js b/scripts/webring.js index 2b08b77..07e5990 100644 --- a/scripts/webring.js +++ b/scripts/webring.js @@ -1,12 +1,3 @@ -const xhr = new XMLHttpRequest(); - -xhr.open("GET", "https://aidang.cc/webring/all") -xhr.send(); -xhr.responseType("json"); -xhr.onload = () => { - if (xhr.readyState == 4 && xhr.status == 200) { - console.log(xhr.response); - } else { - console.log(`Error: ${xhr.status}`); - } -} +fetch("https://aidang.cc/webring/all", { + method: "GET" +}).then((response) => response.json()).then((json) => console.log(json)); |