Need help with Random Quote Generator

Need help with Random Quote Generator
0.0 0

#1

So I’ve been at it for a couple days and I can’t seem to get the button to work properly. I’ve gotten as far as getting a single quote but I seem to be having the caching problem I’ve seen others mention. I’ve switched from $.getJSON to $.ajax so that I can use the “cache: false” argument in my request. Since then I’ve come full circle a couple times to both having the button work and only having it generate one unique quote, then seemingly stop working, or possibly receiving the same quote every time. Any help is appreciated. My codepen: https://codepen.io/Levester/pen/RyRLXg
Edit:
Whoops almost forgot to include the API I’m using: https://quotesondesign.com/api-v4-0/


#2

I cannot see where you have the URL for that quote site in there?

and if you move the cache: false out of the fail function and just below the dataType: "jsonp" that would be the correct place to put it.


#3

Use this for your URL:
url: "https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1",

Move the cache: false up below the URL, and remove the dataType: "jsonp".

Regards,
Ken


#4

Thanks for the help, the button works perfectly now.
I understand now that “cache: false” is an option for the [settings] argument of $.ajax().
Also, clearly I was using the wrong url entirely. I misunderstood the instructions on the website.
Thanks again for the help, much appreciated.