@elaineleung
Posted
Hi zer0VAns, if you're a Firefox user like I am, you can definitely try adding the request header object mentioned by @Darknessflowers, as that was what solved my problem. I see in your code that you're using the w3 library; I'm not familiar with it so I'm not sure where you'd put the header object since w3.getHttpObject
takes a callback function, unlike the fetch API which uses promises. If you're up for trying the fetch API along with using no-cache
, you can use this snippet of code:
function getAdvice() {
fetch("https://api.adviceslip.com/advice", {cache: "no-cache"})
.then( response => response.json())
.then( data => {
const advice = data.slip.advice
text.innerHTML = '"' + advice + '"'
})
}
One other suggestion is, for the mobile view, I think the advice container can use a bit more padding. Anyway, great work on the whole, especially in getting your solution to look really close to the design!
Marked as helpful
@zer0VAns
Posted
@elaineleung @Darknessflowers Thank you very much! Exactly, i use Firefox, i really did not know about the cache. Right now I fix it (the padding thing too XD). Have a great day!