Created
April 25, 2022 09:43
-
-
Save kobitoDevelopment/becd4b1c3290c1057234c6b455c523c7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//サーバー上にあるデータを取得するためのリクエストを実行 | |
fetch("取得したいデータを保持しているURL") | |
.then(function (response) { | |
//fetch成功の場合 | |
console.log(response.json()); //JSON形式 | |
console.log(response.text()); //テキスト形式 | |
console.log(response.blob()); //型付きのバイナリデータ形式 | |
console.log(response.arrayBuffer()); //バイナリデータ形式 | |
}) | |
.catch((error) => { | |
//fetch失敗の場合 | |
console.log("error"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment