I’m redoing my projects from Free Code Camp and I’m trying to remove all instances of jQuery from my code in favor of vanilla JS. Here I am switching from a $.ajax()
to fetch()
and I am having a hard time setting the cache to “false”. I went on the MDN website to look at the API for fetch()
but I’m clearly missing something. Any help is greatly appreciated. This is my code so far, every time I click the quoteButton
I intend for a different quote to be loaded however it is continually loading the same quote.
quoteButton.addEventListener('click',function getQuote() {
fetch(url, {cache: "no-store"})
.then((response) => {
return response.json();
})
.then((response) => {
console.log(response);
});
});