-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp2.js
22 lines (22 loc) · 778 Bytes
/
app2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
window.onload = function getdetails() {
let foodId = localStorage.getItem('foodkey');
console.log(foodId, 'foodid');
fetch(`https://www.themealdb.com/api/json/v1/1/lookup.php?i=${foodId}`)
.then(function (res) {
return res.json();
})
.then((data) => {
console.log(data);
console.log(data.meals[0].strMealThumb);
let html2 = `<p>${data.meals[0].strInstructions}</p>`;
let html3 = `<img src="${data.meals[0].strMealThumb}">`;
let html4 = `<p>${data.meals[0].strMeal}</p>`;
console.log(html3);
console.log(html2);
console.log(html4);
mealdetails.innerHTML = html2;
mealdetailsHeading.innerHTML = html4;
mealdetailsImage.innerHTML = html3;
});
// localStorage.removeItem('foodkey');
};