我想知道是否有人可以爲我目前遇到的這個問題提供一些幫助。我在這方面是全新的,不幸的是編程的教科書Headfirst並沒有很好地解釋這一點。我研究了很多stackoverflows,但無濟於事。任何幫助在正確的方向將不勝感激。謝謝!jSON使用本地存儲API獲取請求
任務是顯示食物菜單以及下面的項目列表。
- 應該使用來自通過Ajax GETrequest檢索的JSON文件的數據生成。
- 生成包含所需菜單項的JSON文件。
- 您決定如何顯示菜單項目。即有序列表,無序列表等。
- 使用localStorge API緩存來自JSON響應的數據
- 確保在數據緩存後不會進行GET請求。
- 當數據緩存
我認爲這是正確的GET請求檢索localStorage的數據?我知道我錯過了東西,但老實說它已經超出了我的頭。
我叫startersMenu.json這裏
var startersMenu = {
"starters": [
{
"name": "Jumbo Lump Crab Cake",
"description": "Creole lobster sauce."
},
{
"name": "Bacon Wrapped Sea Scallops",
"description": "Chardonnay lemon sauce, Mango salsa."
},
{
"name": "Chilled Maine Lobster Cocktail",
"description": "Atomic cocktail sauce and lemon butter."
},
{
"name": "Coconut Shrimp",
"description": "three jumbo tiger shrimp, vanilla orange beurre blanc."
},
{
"name": "Crispy Point Judith Calamari",
"description": "Italian peppers and Bleu cheese Stuffed olives, Atomic cocktail sauce."
},
{
"name": "Oysters on the Half Shell",
"description": "shucked to order, mignonette and Atomic cocktail sauces."
}
]
}