Skip to content

Instantly share code, notes, and snippets.

@Kazunari-h
Last active June 4, 2020 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kazunari-h/e4908eafe478a7f5acb9d8a4c0beebc2 to your computer and use it in GitHub Desktop.
Save Kazunari-h/e4908eafe478a7f5acb9d8a4c0beebc2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<title>axios</title>
</head>
<body>
<script>
// IDを付加したurl
axios.get('https://api.zipaddress.net/?zipcode=1510071')
//成功した場合
.then(function (response) {
console.log(response);
})
//chachでエラーの挙動を定義
.catch(function (error) {
console.log(error);
});
// または
/*
axios.get('/user', {
params: {
zipcode: 1510071
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
*/
</script>
</body>
</html>
[
{
"id": 1,
"name": "彩りイタリアンサラダ(Lサイズ)",
"category": "sidedish",
"type": "salad",
"price": 499,
"calorie": 385,
"salt": 2.5
},
{
"id": 2,
"name": "彩りイタリアンサラダ",
"category": "sidedish",
"type": "salad",
"price": 349,
"calorie": 257,
"salt": 1.7
},
{
"id": 3,
"name": "チキンとブロッコリーのサラダ(Lサイズ)",
"category": "sidedish",
"type": "salad",
"price": 499,
"calorie": 274,
"salt": 2.5
},
{
"id": 4,
"name": "チキンとブロッコリーのサラダ",
"category": "sidedish",
"type": "salad",
"price": 349,
"calorie": 182,
"salt": 1.7
},
{
"id": 5,
"name": "わかめとオクラのサラダ(Lサイズ)",
"category": "sidedish",
"type": "salad",
"price": 499,
"calorie": 214,
"salt": 4.4
},
{
"id": 6,
"name": "わかめとオクラのサラダ",
"category": "sidedish",
"type": "salad",
"price": 349,
"calorie": 143,
"salt": 3
},
{
"id": 7,
"name": "小エビのサラダ(Lサイズ)",
"category": "sidedish",
"type": "salad",
"price": 499,
"calorie": 189,
"salt": 2.1
},
{
"id": 8,
"name": "小エビのサラダ",
"category": "sidedish",
"type": "salad",
"price": 349,
"calorie": 126,
"salt": 1.4
},
{
"id": 9,
"name": "コーンクリームスープ",
"category": "sidedish",
"type": "soup",
"price": 149,
"calorie": 142,
"salt": 1.1
},
{
"id": 10,
"name": "(季節限定)とろとろ玉ねぎのスープ",
"category": "sidedish",
"type": "soup",
"price": 299,
"calorie": 317,
"salt": 2.4
},
{
"id": 11,
"name": "マッシュルームスープ",
"category": "sidedish",
"type": "soup",
"price": 149,
"calorie": 130,
"salt": 0.9
},
{
"id": 12,
"name": "削りたてペコリーノチーズ",
"category": "sidedish",
"type": "appetizer",
"price": 100,
"calorie": 59,
"salt": 0.6
},
{
"id": 13,
"name": "ミニフィセル",
"category": "sidedish",
"type": "appetizer",
"price": 169,
"calorie": 188,
"salt": 1
},
{
"id": 14,
"name": "ガーリックトースト",
"category": "sidedish",
"type": "appetizer",
"price": 189,
"calorie": 252,
"salt": 1.1
},
{
"id": 15,
"name": "セットドリンクバー",
"category": "drink",
"type": "drinkbar",
"price": 190,
"calorie": 0,
"salt": 0
},
{
"id": 16,
"name": "辛味チキン",
"category": "sidedish",
"type": "appetizer",
"price": 299,
"calorie": 374,
"salt": 2.2
},
{
"id": 17,
"name": "(季節限定)セロリのピクルス",
"category": "sidedish",
"type": "appetizer",
"price": 199,
"calorie": 52,
"salt": 1.3
},
{
"id": 18,
"name": "ポップコーンシュリンプ",
"category": "sidedish",
"type": "appetizer",
"price": 299,
"calorie": 215,
"salt": 1.4
},
{
"id": 19,
"name": "エスカルゴのオーブン焼き",
"category": "sidedish",
"type": "appetizer",
"price": 399,
"calorie": 256,
"salt": 1.6
},
{
"id": 20,
"name": "ムール貝のガーリック焼き",
"category": "sidedish",
"type": "appetizer",
"price": 399,
"calorie": 164,
"salt": 1.3
},
{
"id": 21,
"name": "野菜ソースのグリルソーセージ",
"category": "sidedish",
"type": "appetizer",
"price": 399,
"calorie": 570,
"salt": 3.1
},
{
"id": 22,
"name": "チョリソー",
"category": "sidedish",
"type": "appetizer",
"price": 399,
"calorie": 393,
"salt": 2
},
{
"id": 23,
"name": "柔らか青豆の温サラダ",
"category": "sidedish",
"type": "appetizer",
"price": 199,
"calorie": 213,
"salt": 0.8
},
{
"id": 24,
"name": "ほうれん草のソテー",
"category": "sidedish",
"type": "appetizer",
"price": 199,
"calorie": 123,
"salt": 1.1
},
{
"id": 25,
"name": "キャベツとアンチョビのソテー",
"category": "sidedish",
"type": "appetizer",
"price": 199,
"calorie": 80,
"salt": 1.5
},
{
"id": 26,
"name": "フリウリ風フリコ",
"category": "sidedish",
"type": "appetizer",
"price": 299,
"calorie": 299,
"salt": 0.9
},
{
"id": 27,
"name": "チーズたっぷりフリウリ風フリコ",
"category": "sidedish",
"type": "appetizer",
"price": 399,
"calorie": 534,
"salt": 1.8
},
{
"id": 28,
"name": "フォッカチオ",
"category": "sidedish",
"type": "foccatia",
"price": 119,
"calorie": 214,
"salt": 0.8
},
{
"id": 29,
"name": "プチフォッカ",
"category": "sidedish",
"type": "foccatia",
"price": 139,
"calorie": 214,
"salt": 0.8
},
{
"id": 30,
"name": "セットプチフォッカ",
"category": "sidedish",
"type": "foccatia",
"price": 79,
"calorie": 107,
"salt": 0.4
},
{
"id": 31,
"name": "グラスワイン",
"category": "drink",
"type": "alcohol",
"price": 100,
"calorie": 0,
"salt": 0
},
{
"id": 32,
"name": "デカンタ・250ml",
"category": "drink",
"type": "alcohol",
"price": 200,
"calorie": 0,
"salt": 0
},
{
"id": 33,
"name": "デカンタ・500ml",
"category": "drink",
"type": "alcohol",
"price": 399,
"calorie": 0,
"salt": 0
},
{
"id": 34,
"name": "キリン一番搾り(ジョッキ)",
"category": "drink",
"type": "alcohol",
"price": 399,
"calorie": 0,
"salt": 0
},
{
"id": 35,
"name": "キリン一番搾り(グラス)",
"category": "drink",
"type": "alcohol",
"price": 299,
"calorie": 0,
"salt": 0
},
{
"id": 36,
"name": "ストロングゼロダブルレモン",
"category": "drink",
"type": "alcohol",
"price": 379,
"calorie": 0,
"salt": 0
},
{
"id": 37,
"name": "マグナム・1500ml",
"category": "drink",
"type": "alcohol",
"price": 1080,
"calorie": 0,
"salt": 0
},
{
"id": 38,
"name": "ランブルスコセッコ(赤)辛口",
"category": "drink",
"type": "alcohol",
"price": 1080,
"calorie": 0,
"salt": 0
},
{
"id": 39,
"name": "ランブルスコ(ロゼ)甘口",
"category": "drink",
"type": "alcohol",
"price": 1080,
"calorie": 0,
"salt": 0
},
{
"id": 40,
"name": "ベルデッキオ(辛口・中)",
"category": "drink",
"type": "alcohol",
"price": 1080,
"calorie": 0,
"salt": 0
},
{
"id": 41,
"name": "キャンティ(辛口・やや重い)",
"category": "drink",
"type": "alcohol",
"price": 1080,
"calorie": 0,
"salt": 0
},
{
"id": 42,
"name": "キャンティルフィナリゼルパ(辛口・重い)",
"category": "drink",
"type": "alcohol",
"price": 2160,
"calorie": 0,
"salt": 0
},
{
"id": 43,
"name": "サイゼリヤプレミアム(辛口・重い)",
"category": "drink",
"type": "alcohol",
"price": 2160,
"calorie": 0,
"salt": 0
},
{
"id": 44,
"name": "サントリーオールフリー",
"category": "drink",
"type": "alcohol",
"price": 259,
"calorie": 0,
"salt": 0
},
{
"id": 45,
"name": "グラッパ(食後酒)",
"category": "drink",
"type": "alcohol",
"price": 379,
"calorie": 0,
"salt": 0
},
{
"id": 46,
"name": "フレッシュチーズとトマトのサラダ",
"category": "sidedish",
"type": "appetizer",
"price": 299,
"calorie": 200,
"salt": 0.4
},
{
"id": 47,
"name": "フレッシュチーズとトマトのサラダ(Wサイズ)",
"category": "sidedish",
"type": "appetizer",
"price": 598,
"calorie": 400,
"salt": 0.8
},
{
"id": 48,
"name": "プロシュート",
"category": "sidedish",
"type": "appetizer",
"price": 399,
"calorie": 162,
"salt": 1.8
},
{
"id": 49,
"name": "プロシュート(Wサイズ)",
"category": "sidedish",
"type": "appetizer",
"price": 798,
"calorie": 324,
"salt": 3.6
},
{
"id": 50,
"name": "熟成ミラノサラミ",
"category": "sidedish",
"type": "appetizer",
"price": 299,
"calorie": 95,
"salt": 1.1
},
{
"id": 51,
"name": "熟成ミラノサラミ(Wサイズ)",
"category": "sidedish",
"type": "appetizer",
"price": 598,
"calorie": 190,
"salt": 2.2
},
{
"id": 52,
"name": "マルゲリータピザ",
"category": "meal",
"type": "pizza",
"price": 399,
"calorie": 568,
"salt": 2.5
},
{
"id": 53,
"name": "パンチェッタのピザ",
"category": "meal",
"type": "pizza",
"price": 399,
"calorie": 646,
"salt": 2.9
},
{
"id": 54,
"name": "野菜ときのこのピザ",
"category": "meal",
"type": "pizza",
"price": 399,
"calorie": 610,
"salt": 2.7
},
{
"id": 55,
"name": "アンチョビのピザ(ルーコラ葉入り)",
"category": "meal",
"type": "pizza",
"price": 399,
"calorie": 543,
"salt": 4.7
},
{
"id": 56,
"name": "バッファローモッツァレラのピザ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 575,
"salt": 2.3
},
{
"id": 57,
"name": "たっぷりコーンのピザ",
"category": "meal",
"type": "pizza",
"price": 399,
"calorie": 610,
"salt": 2.7
},
{
"id": 58,
"name": "たらこクリームのピザ",
"category": "meal",
"type": "pizza",
"price": 399,
"calorie": 615,
"salt": 3.3
},
{
"id": 59,
"name": "マルゲリータピザ + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 568,
"salt": 2.5
},
{
"id": 60,
"name": "パンチェッタのピザ + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 646,
"salt": 2.9
},
{
"id": 61,
"name": "野菜ときのこのピザ + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 610,
"salt": 2.7
},
{
"id": 62,
"name": "アンチョビのピザ(ルーコラ葉入り) + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 543,
"salt": 4.7
},
{
"id": 63,
"name": "バッファローモッツァレラのピザ + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 599,
"calorie": 575,
"salt": 2.3
},
{
"id": 64,
"name": "たっぷりコーンのピザ + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 610,
"salt": 2.7
},
{
"id": 65,
"name": "たらこクリームのピザ + トッピングチーズ",
"category": "meal",
"type": "pizza",
"price": 499,
"calorie": 615,
"salt": 3.3
},
{
"id": 66,
"name": "ほうれん草のグラタン",
"category": "meal",
"type": "gratin",
"price": 399,
"calorie": 521,
"salt": 1.9
},
{
"id": 67,
"name": "シーフードグラタン",
"category": "meal",
"type": "gratin",
"price": 499,
"calorie": 537,
"salt": 2.2
},
{
"id": 68,
"name": "ほうれん草のグラタン + トッピングチーズ",
"category": "meal",
"type": "gratin",
"price": 499,
"calorie": 521,
"salt": 1.9
},
{
"id": 69,
"name": "シーフードグラタン + トッピングチーズ",
"category": "meal",
"type": "gratin",
"price": 599,
"calorie": 537,
"salt": 2.2
},
{
"id": 70,
"name": "アラビアータ",
"category": "meal",
"type": "pasta",
"price": 399,
"calorie": 601,
"salt": 2.5
},
{
"id": 71,
"name": "アラビアータ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 770,
"calorie": 1202,
"salt": 5
},
{
"id": 72,
"name": "ミートソースボロニア風",
"category": "meal",
"type": "pasta",
"price": 399,
"calorie": 552,
"salt": 2.5
},
{
"id": 73,
"name": "ミートソースボロニア風(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 770,
"calorie": 1104,
"salt": 5
},
{
"id": 74,
"name": "半熟卵のミートソースボロニア風",
"category": "meal",
"type": "pasta",
"price": 468,
"calorie": 642,
"salt": 2.7
},
{
"id": 75,
"name": "アーリオ・オーリオ",
"category": "meal",
"type": "pasta",
"price": 299,
"calorie": 457,
"salt": 1.4
},
{
"id": 76,
"name": "アーリオ・オーリオ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 574,
"calorie": 914,
"salt": 2.8
},
{
"id": 77,
"name": "ペペロンチーノ",
"category": "meal",
"type": "pasta",
"price": 299,
"calorie": 457,
"salt": 1.4
},
{
"id": 78,
"name": "ペペロンチーノ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 574,
"calorie": 914,
"salt": 2.8
},
{
"id": 79,
"name": "キャベツのペペロンチーノ",
"category": "meal",
"type": "pasta",
"price": 399,
"calorie": 587,
"salt": 1.6
},
{
"id": 80,
"name": "キャベツのペペロンチーノ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 770,
"calorie": 1174,
"salt": 3.2
},
{
"id": 81,
"name": "タラコソースシシリー風",
"category": "meal",
"type": "pasta",
"price": 399,
"calorie": 550,
"salt": 2
},
{
"id": 82,
"name": "タラコソースシシリー風(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 770,
"calorie": 1100,
"salt": 4
},
{
"id": 83,
"name": "たっぷり小エビのオーロラソース",
"category": "meal",
"type": "pasta",
"price": 599,
"calorie": 663,
"salt": 3
},
{
"id": 84,
"name": "牛すね肉のラグーソース",
"category": "meal",
"type": "pasta",
"price": 599,
"calorie": 638,
"salt": 3.1
},
{
"id": 85,
"name": "パルマ風スパゲッティ",
"category": "meal",
"type": "pasta",
"price": 399,
"calorie": 671,
"salt": 2.6
},
{
"id": 86,
"name": "パルマ風スパゲッティ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 770,
"calorie": 1342,
"salt": 5.2
},
{
"id": 87,
"name": "イカの墨入りスパゲッティ",
"category": "meal",
"type": "pasta",
"price": 499,
"calorie": 579,
"salt": 2.2
},
{
"id": 88,
"name": "イカの墨入りスパゲッティ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 976,
"calorie": 1158,
"salt": 4.4
},
{
"id": 89,
"name": "カルボナーラ",
"category": "meal",
"type": "pasta",
"price": 499,
"calorie": 737,
"salt": 2
},
{
"id": 90,
"name": "カルボナーラ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 976,
"calorie": 1474,
"salt": 4
},
{
"id": 91,
"name": "ナポリジェノベーゼ",
"category": "meal",
"type": "pasta",
"price": 499,
"calorie": 516,
"salt": 2.2
},
{
"id": 92,
"name": "ナポリジェノベーゼ(Wサイズ)",
"category": "meal",
"type": "pasta",
"price": 976,
"calorie": 1032,
"salt": 4.4
},
{
"id": 93,
"name": "トッピング半熟卵",
"category": "sidedish",
"type": "appetizer",
"price": 69,
"calorie": 90,
"salt": 0.2
},
{
"id": 94,
"name": "ミラノ風ドリア",
"category": "meal",
"type": "doria",
"price": 299,
"calorie": 542,
"salt": 2.7
},
{
"id": 95,
"name": "半熟卵のミラノ風ドリア",
"category": "meal",
"type": "doria",
"price": 368,
"calorie": 632,
"salt": 2.9
},
{
"id": 96,
"name": "セットプチフォッカ付きミラノ風ドリア",
"category": "meal",
"type": "doria",
"price": 378,
"calorie": 649,
"salt": 3.1
},
{
"id": 97,
"name": "いろどり野菜のミラノ風ドリア",
"category": "meal",
"type": "doria",
"price": 399,
"calorie": 590,
"salt": 3.1
},
{
"id": 98,
"name": "エビとイカのドリア",
"category": "meal",
"type": "doria",
"price": 499,
"calorie": 624,
"salt": 2.9
},
{
"id": 99,
"name": "ミラノ風ドリア + トッピングチーズ",
"category": "meal",
"type": "doria",
"price": 399,
"calorie": 542,
"salt": 2.7
},
{
"id": 100,
"name": "半熟卵のミラノ風ドリア + トッピングチーズ",
"category": "meal",
"type": "doria",
"price": 468,
"calorie": 632,
"salt": 2.9
},
{
"id": 101,
"name": "セットプチフォッカ付きミラノ風ドリア + トッピングチーズ",
"category": "meal",
"type": "doria",
"price": 478,
"calorie": 649,
"salt": 3.1
},
{
"id": 102,
"name": "いろどり野菜のミラノ風ドリア + トッピングチーズ",
"category": "meal",
"type": "doria",
"price": 499,
"calorie": 590,
"salt": 3.1
},
{
"id": 103,
"name": "エビとイカのドリア + トッピングチーズ",
"category": "meal",
"type": "doria",
"price": 599,
"calorie": 624,
"salt": 2.9
},
{
"id": 104,
"name": "シーフードパエリア",
"category": "meal",
"type": "rice",
"price": 599,
"calorie": 595,
"salt": 3.6
},
{
"id": 105,
"name": "エビと野菜のトマトクリームリゾット",
"category": "meal",
"type": "rice",
"price": 399,
"calorie": 311,
"salt": 2.3
},
{
"id": 106,
"name": "ハヤシ&ターメリックライス",
"category": "meal",
"type": "rice",
"price": 499,
"calorie": 676,
"salt": 3.9
},
{
"id": 107,
"name": "半熟卵のハヤシ&ターメリックライス",
"category": "meal",
"type": "rice",
"price": 568,
"calorie": 766,
"salt": 4.1
},
{
"id": 108,
"name": "ミックスグリル",
"category": "meal",
"type": "hamburg",
"price": 599,
"calorie": 823,
"salt": 3.8
},
{
"id": 109,
"name": "ハンバーグステーキ",
"category": "meal",
"type": "hamburg",
"price": 399,
"calorie": 514,
"salt": 2.3
},
{
"id": 110,
"name": "デミグラスソースのハンバーグ",
"category": "meal",
"type": "hamburg",
"price": 499,
"calorie": 628,
"salt": 3.6
},
{
"id": 111,
"name": "ディアボロ風ハンバーグ",
"category": "meal",
"type": "hamburg",
"price": 499,
"calorie": 585,
"salt": 2.6
},
{
"id": 112,
"name": "イタリアンハンバーグ",
"category": "meal",
"type": "hamburg",
"price": 499,
"calorie": 633,
"salt": 2.5
},
{
"id": 113,
"name": "焼肉とハンバーグの盛合せ",
"category": "meal",
"type": "hamburg",
"price": 599,
"calorie": 709,
"salt": 3.4
},
{
"id": 114,
"name": "若鶏のグリル(ディアボラ風)",
"category": "meal",
"type": "chicken",
"price": 499,
"calorie": 541,
"salt": 2.1
},
{
"id": 115,
"name": "柔らかチキンのチーズ焼き",
"category": "meal",
"type": "chicken",
"price": 499,
"calorie": 588,
"salt": 2
},
{
"id": 116,
"name": "パンチェッタと若鶏のグリル",
"category": "meal",
"type": "chicken",
"price": 599,
"calorie": 663,
"salt": 2.5
},
{
"id": 117,
"name": "リブステーキ",
"category": "meal",
"type": "steak",
"price": 999,
"calorie": 621,
"salt": 1.5
},
{
"id": 118,
"name": "トッピングディアボラ風ソース(ガーリックガルム付き)",
"category": "sidedish",
"type": "appetizer",
"price": 149,
"calorie": 99,
"salt": 1.1
},
{
"id": 119,
"name": "ライス",
"category": "sidedish",
"type": "rice",
"price": 169,
"calorie": 303,
"salt": 0
},
{
"id": 120,
"name": "ラージライス",
"category": "sidedish",
"type": "rice",
"price": 219,
"calorie": 454,
"salt": 0
},
{
"id": 121,
"name": "スモールライス",
"category": "sidedish",
"type": "rice",
"price": 119,
"calorie": 151,
"salt": 0
},
{
"id": 122,
"name": "ティラミス クラシコ",
"category": "sidedish",
"type": "dessert",
"price": 299,
"calorie": 229,
"salt": 0.1
},
{
"id": 123,
"name": "プリンとティラミス クラシコの盛合せ",
"category": "sidedish",
"type": "dessert",
"price": 499,
"calorie": 445,
"salt": 0.2
},
{
"id": 124,
"name": "とろけるティラミス&コーヒーゼリー",
"category": "sidedish",
"type": "dessert",
"price": 399,
"calorie": 284,
"salt": 0.1
},
{
"id": 125,
"name": "いちごソースのパンナコッタ",
"category": "sidedish",
"type": "dessert",
"price": 299,
"calorie": 184,
"salt": 0.2
},
{
"id": 126,
"name": "(季節限定)ヘーゼルナッツ",
"category": "sidedish",
"type": "dessert",
"price": 199,
"calorie": 143,
"salt": 0
},
{
"id": 127,
"name": "(季節限定)プリンとヘーゼルナッツの盛合せ",
"category": "sidedish",
"type": "dessert",
"price": 399,
"calorie": 359,
"salt": 0.1
},
{
"id": 128,
"name": "シナモンフォッカチオ",
"category": "sidedish",
"type": "foccatia",
"price": 169,
"calorie": 246,
"salt": 0.8
},
{
"id": 129,
"name": "ミルクアイスのせシナモンフォッカチオ",
"category": "sidedish",
"type": "dessert",
"price": 319,
"calorie": 346,
"salt": 0.9
},
{
"id": 130,
"name": "ミルクジェラート",
"category": "sidedish",
"type": "dessert",
"price": 199,
"calorie": 100,
"salt": 0.1
},
{
"id": 131,
"name": "すっきりレモンのシャーベット",
"category": "sidedish",
"type": "dessert",
"price": 199,
"calorie": 127,
"salt": 0
},
{
"id": 132,
"name": "イタリアンプリン",
"category": "sidedish",
"type": "dessert",
"price": 249,
"calorie": 216,
"salt": 0.1
},
{
"id": 133,
"name": "チョコレートケーキ",
"category": "sidedish",
"type": "dessert",
"price": 299,
"calorie": 166,
"salt": 0.1
},
{
"id": 134,
"name": "コーヒーゼリー",
"category": "sidedish",
"type": "dessert",
"price": 299,
"calorie": 162,
"salt": 0.1
},
{
"id": 135,
"name": "トリフアイスクリーム",
"category": "sidedish",
"type": "dessert",
"price": 369,
"calorie": 164,
"salt": 0.1
}
]
var xhr = new XMLHttpRequest();
// ハンドラの登録.
xhr.onreadystatechange = function() {
switch ( xhr.readyState ) {
case 0:
// 未初期化状態.
console.log( 'uninitialized!' );
break;
case 1: // データ送信中.
console.log( 'loading...' );
break;
case 2: // 応答待ち.
console.log( 'loaded.' );
break;
case 3: // データ受信中.
console.log( 'interactive... '+xhr.responseText.length+' bytes.' );
break;
case 4: // データ受信完了.
if( xhr.status == 200 || xhr.status == 304 ) {
var data = xhr.responseText; // responseXML もあり
console.log( 'COMPLETE! :'+data );
} else {
console.log( 'Failed. HttpStatus: '+xhr.statusText );
}
break;
}
};
xhr.open('GET', 'https://api.zipaddress.net/', false );
// POST 送信の場合は Content-Type は固定.
// xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
//
xhr.send( 'zipcode=1510071' );
// サーバとの通信を切る
xhr.abort(); // 再利用する際には必ずabort()する
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment