Random Quote Generator - API call in CodePen returns same value every time

In CodePen, my API call is returning the same quote every time, but when I run the GET request outside CodePen in Postman, it does give a random quote. And I see other people using this API on CodePen, so it’s something wrong with my implementation… any help is appreciated.

QuotesByDesign cache’s the response unless you specifically tell the API not to. The easiest way to accomplish this is not put the following inside (at the top) of your $(document.ready callback function.

$.ajaxSetup({ cache: false });

This will force all the AJAX calls to the API to not cache the response, so you will get a new quote each time.

1 Like